Skip to content
By making use of OSM data this project makes it possible to retrieve a location name for any coordinate worldwide in different languages.
Swift Shell Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Reverse Geocoding Service

Language Vapor Version CircleCI


For location-based services, it is often useful to display a name for any location. This can be achieved by reverse geocoding. By making use of Open Street Map data this project makes it possible to retrieve a location name for any coordinate worldwide in different languages (currently English and German).


Single coordinate location name

GET /location/<latitude>/<longitude> This is an example response for the GET query on http://localhost:8080/location/52.51/13.40:

    "coordinate": {
        "latitude": 52.5099983215332,
        "longitude": 13.3999996185303
    "de": "Mitte, Berlin",
    "en": "Mitte, Berlin"

Multi coordiante location name

POST /location/<latitude>/<longitude> (POST method due to body content). The body looks like the following:

    "coordinates": [
            "latitude": 51.796873,
            "longitude": 8.434899
            "latitude": 51.804507,
            "longitude": 8.432158

This request will return a nullified coordiante object in the response due to multiple input coordinates.


  • Swift 4.2 is used with Vapor 3.
  • Postgres with PostGIS is used for data storage and queries.
  • A docker-compose file is placed in the root directory. See the docker section for further steps with docker.


The following data structure is needed in the table place_polygon:

  • name: String
  • name:de: String
  • name:en: String
  • way: Geometry - Polygon
  • admin_level: Int
  • way_area: Double

Here are instructions to create this table from the Open Street Map data. So the data is not part of this project.

Installation with Docker

  1. Clone this repo.
  2. Change the secrets for the database password and change the password file paths in the docker-compose file.
  3. Add a PostgreSQL data volume to store the database data on disk if you want to speed up noninitial startups.
  4. Run docker-compose up.
  5. Import the prepared data (see the previous step) into the PostgreSQL database.

The web server also exposes a health endpoint to check if the service is running. The endpoint is available under GET /health and returns the response code 200.

Environment Variables

  • DB_PASSWORD (only used if DB_PASSWORD_FILE is not set)
  • REDIS_URL for the redis server url


This project is available under the AGPL Version 3 license. See the LICENSE file for more info.


You can contribute to this project by submitting a detailed issue or by forking this project and sending a pull request. Contributions of any kind are very welcome :)

You can’t perform that action at this time.