npm i node-geocoder
from npm:
https://www.npmjs.com/package/node-geocoder
A wrapper for many providers to get geocoding, and reverse-geocoding.
to allow debug
:
DEBUG=runner,*
Add the following to tsconfig.json
:
//let debugger stop in TS files:
"sourceMap": true
Do not forget the "recompile after changes flag":
uses nominatim.
http://nominatim.org/release-docs/latest/api/Reverse
i use also the accept-language
param, to set the language of result.
The full object (actually it is an array of objects) that OSM return is:
[{
latitude: 32.10156344707361,
longitude: 34.85901258256623,
formattedAddress: 'Em HaMoshavot, Kiryat Aryeh Industrial Zone, Petah Tikva, Petah Tikva Subdistrict, Center District, no, Israel',
country: 'Israel',
city: 'Petah Tikva',
state: 'Center District',
zipcode: 'no',
streetName: 'Em HaMoshavot',
streetNumber: undefined,
countryCode: 'IL',
neighbourhood: '',
provider: 'openstreetmap'
}]
https://developer.mapquest.com/documentation/open/
Important: Usage of the Open APIs requires an API key. If you do not already have one, please sign in to the MapQuest Developer Network and visit the Keys & Reporting page.
https://www.bigdatacloud.com/customer/account
the HUGE problem with this solution is that if you exceed the quota, BDC exits(!!!). No error is thrown, but your app is dead.
This solution cannot be used (unless you pay).
npm install --save mapbox
from npm:
UI (GL) based: https://www.npmjs.com/package/@mapbox/mapbox-gl-geocoder
mapbox-sdk-js: https://www.npmjs.com/package/mapbox