Skip to content
This repository was archived by the owner on Mar 31, 2020. It is now read-only.

API that takes latitude/longitude pairs and returns an ID and metadata for the administrative boundaries they're located within

License

Notifications You must be signed in to change notification settings

unicef/magicbox-latlon-admin-server

Repository files navigation

Latitude/longitude coordinates to admin ID server

Chat on Gitter Build Status

This is a component of Magic Box

API that takes latitude/longitude pairs and returns an ID and metadata for the administrative boundaries they're located within

screenshot

Example

curl http://localhost:8082/api/coordinates/33.385586,66.445313

returns ...

{
  "iso": "AFG",
  "name_0": "Afghanistan",
  "name_1": "Daykundi",
  "name_2": "Gizab",
  "admin_id": "afg_1_6_53_gadm2-8",
  "lon": 66.445313,
  "lat": 33.385586
}

Dependencies:

NVM

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash

Node.js

nvm install 8

Prerequisites

Setup

git clone https://github.com/unicef/coordinates_to_admin_id_server
cd coordinates_to_admin_id_server
cp config-sample.js config.js
npm install
npm run build

Batch example

curl http://localhost:8082/api/coordinates/33.385586,66.445313,-16.351768,-45.703125

Note to pairs of coordinates in the url. This returns:
[
  {
    "iso": "AFG",
    "name_0": "Afghanistan",
    "name_1": "Daykundi",
    "name_2": "Gizab",
    "admin_id": "afg_1_6_53_gadm2-8",
    "lon": 66.445313,
    "lat": 33.385586
  },
  {
    "iso": "BRA",
    "name_0": "Brazil",
    "name_1": "MinasGerais",
    "name_2": "Riachinho",
    "name_3": "Riachinho",
    "admin_id": "bra_33_13_2179_4369_gadm2-8",
    "lon": -45.703125,
    "lat": -16.351768
  }
]

About

API that takes latitude/longitude pairs and returns an ID and metadata for the administrative boundaries they're located within

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •