For further reference, please consider the following sections:
- It should be a simple java application based on Spring Boot framework.
- The application should have a REST API that allows users to search by address and get all addresses by coordinates.
- The result should be printed in JSON format.
- Your code should be version controlled and publicly accessible for us to review (github/bit-bucket/gitlab/etc)
- Implement Authorization/Authentication for result endpoints.
- Implement Cache for storing very often using coordinates.
- Deploy application to Docker container (Dockerfile artifact).
- You need to implement application that uses third party api Nominatim API and create the following endpoints:
- To search by address and save coordinates(latitude,longitude) in H2 DB or any Persistence Db
- To get all addresses by coordinates that have been stored in DB. The application must be called by REST API for receiving all addresses from Nominatim API by saved coordinates.
- Java 15
- Spring Boot 2.5
- H2 database
- Lombok
- Implemented fetching data from Nominatim API using json, jsonv2, geojson and geocodejson formats
- For data fetching from Nominatim program uses only Nominatim /search and Nominatim /lookup
because Nominatim /reverse returns an imprecise, approximate result.
And lookup for a single OSM object by its OSM id using Nominatim /reverse is deprecated now by Nominatim.
Instead of that, program generates OSM ID's using data in Nominatim response jsons and uses them to search by Nominatim /lookup
Client must not generate these OSM ID's itself, but can place JSON request body in into request.
This JSON request body must contain only points of coordinates in such format:
[{"lat": 52.444761,"lon": 13.4002923 }, {"lat": 52.470678199999995,"lon": 13.385307250760587 }, {"lat": 52.4553875,"lon": 13.384646 }]
Client also can send requests with empty or null set of points to receive all addresses by all stored coordinates.
But this option is available only for users withADMIN
role - All response json data converted to own simple json, jsonv2, geojson and geocodejson formats (removed some metadata)
- Output of json, jsonv2 and geojson now is similar except of geocodejson.
Thereforerating-cache.savememory
property was set astrue
. This option prevents from caching same data.
But if needs to change output data and make different formats for json, jsonv2 and geojson then you have to setrating-cache.savememory
property asfalse
- Cache can work in
multi-thread
andsingle-thread
modes.multi-thread
mode is thread-safe, but it consumes more memory thansingle-thread
.
Set necessary active profile inapplication.yaml
to change this mode. - You can also make fine-tuning of cache by changing
rating-cache
params - If you want to change H2 DB settings, you have to change
datasource
params also inapplication.yaml
property file
- Run application -> use
GeoLocator.postman_collection.json
to test for base cases in Postman - If you want to create custom requests or
curl
's -> please use user and admin credentials fromdata.sql
file
docker run -p8080:8080 atanava/geo-locator:beta
- Use user and admin credentials from
data.sql
file - Search bakery in Berlin json
- Search by address parameters json
- Search by simple address
- Lookup all (for admin only)