Skip to content

Latest commit

 

History

History
80 lines (53 loc) · 4.79 KB

README.md

File metadata and controls

80 lines (53 loc) · 4.79 KB

Development

To run the server with IntelliJ, first you need to run

mvn clean install package

Then create a run configuration and define the following environment:

elasticsearch.apiKey=<your elastic search instance api key>
elasticsearch.serverUrl=<your elastic search instance url. Default is: http://localhost:9200>
server.port=<available local port to access the server. Default is: 8080>

Then you can run the server with the run configuration. On successful start, you should be able to access:

http://localhost:8080/swagger-ui/index.html (if you use the default port)

OGC API Java Server

This module contains the real implementation of the OGC API interface generated by the other modules. The packages is organized in the following way:

Each package is going to implement one OGC function set, for example tile pages implemented the OGC tile api. And there are some problems with the generated interface and can be handled in the following ways:

Conflict RESTful api

For example /collections is defined in common, feature, tile, if you implement these interface then the spring cannot started due to conflict endpoints.

A custom configuration is created CustomMvcRegistrations.java to intercept the endpoint creations so that if the method is marked with @Hidden, it will be ignored in both swagger document and endpoint creation. Hence mark the @Hidden if you see conflict and leave 1 method that needed, or mark all as @Hidden and manually craft on if required.

Unmapped Enum in @PathValue and @ParamValue

By default, Spring used the converter which will not convert Enum correctly if the Enum is not name exactly the same as the enum definition, for example ABC("abc") will not convert correctly if your string is abc, instead of ABC.

A CustomWebMvcConfigurer.java is created so that additional formatter is added to handle Enum convert.

The core package

This is the place to store most logic on querying the Search engine. You can define your own Search and if the system found another Search, the default ElasticSearch will not be provisioned.

Common Query Language (CQL) parser

We use the geotools' CQl parser and extend it so that it generated the needed Elastic Search Query, please read CQLToElasticFilterFactory.java. Please get some understanding of ElasticSearch before you begin your coding, in short Elastic search have the following fields, text, keywords and wildcard. Each have its own behavior and will impact your search result.

API Call

Below table shows how to call the OGC API, assume the ${prefix} is /api/v1/ogc/

Item Description API Example Comments
1 Find record based on field ${prefix}/collections?filter=FILED_NAME='VALUE'&sortby='VALUE' ${prefix}/collections?filter=title='This is a test'&sortby=-temporal,+score It use elastic match_phase query internally, so the text will be match according to phase order, so lets say you want a title 'This is a test', then 'is a test' will be a hit while 'is the a test' is not. Upper or lower case makes no different.
2 Swagger API page ${prefix}/api or api?f=html With f=html, it shows the swagger api page, else it shows the open api json file

Support fields

Please refer to class CQLCollectionsFields.java, the enum name there are the supported field name in CQL filter

Sort By

May sure you name sortby correctly, do not name is as sortBy, it will not work. -before a field means descending order +before a field means asc order. Not all field is sortable, right now only

  • id
  • score
  • temporal
  • title