nominatim-geocode

Nominatim geocoding service wrapper

Usage no npm install needed!

<script type="module">
  import nominatimGeocode from 'https://cdn.skypack.dev/nominatim-geocode';
</script>

README

nominatim-geocode

Wrapper for Nominatim geocoding service. Uses JSONP

Nominatim docs.

Demo

Usage

import nominatim from 'nominatim-geocode';

nominatim.reverse({ lat: 55, lng: 33 }, (err, result) => {
  if(!err) console.log(result);
  // {
  //  address: {...},
  //  display_name: "22, Golestan, Iran"
  //  lat: "36.9631102"
  //  lon: "54.9534786"
  //  osm_id: "196174062"
  //  ...
  // }
});

nominatim.geocode({
  q: 'Unter den Linden, Berlin'
}, (err, results) {
  if (!err) {
    console.log(results.map((location) => {
      return location.display_name;
    });
    // [
    //  "Unter den Linden, Scheunenviertel, Митте, Berlin, 10117, Germany",
    //  "Унтер-ден-Линден, Scheunenviertel, Митте, Berlin, 10117, Germany",
    //  "Under the linden trees, Митте, Berlin, 10117, Germany",
    //  "Under the linden trees, Митте, Berlin, 10117, Germany",
    //  "Under the linden trees, Митте, Berlin, 10117, Germany",
    //  "Under the linden trees, Митте, Berlin, 10117, Germany",
    //  "Унтер-ден-Линден, Митте, Berlin, 10117, Germany",
    //  "Унтер-ден-Линден, Митте, Berlin, 10117, Germany"
    //]
  }
});

License

MIT