Skip to content

beyondopen/geocode-cache-service

Repository files navigation

cache-geocode-service

Flask app to geocode locations and cache the results.

Using https://developer.here.com/documentation/geocoding-search-api/dev_guide/index.html.

https://developer.here.com/documentation/geocoding-search-api/api-reference-swagger.html

curl -u username:password https://geocode.app.vis.one/\?city=Berlin\&provider\=here\&country\=Deutschland\&state\=Berlin

API

Two endpoints:

GET

GET https://geocode.app.vis.one/?provider=here&city=Haldensleben&county=B%C3%B6rde&state=Sachsen-Anhalt&country=Deutschland

Returns 400 if no location was found.

POST

POST https://geocode.app.vis.one/

with data in body:

{
  "provider": "here",
  "locations": [
    {
      "query": {
        "city": "Haldensleben",
        "county": "Börde",
        "state": "Sachsen-Anhalt",
        "country": "Deutschland"
      }
    }
  ]
}

NB: Returns 200 even if no location wasn't found (for one item). Iterate over the responding array to verify if matching geo coords were found.

Development

Create keys.txt and store a HERE API key in it.

docker-compose up

Deployment

Deploy with Dokku.

sudo dokku run geocode flask resetdb

License

MIT