geocoder-geojson v1.11.0
Geocoder GeoJSON
Geocoding results according to the GeoJSON specification.
Install
$ npm install --save geocoder-geojsonInstall globaly to access geocode via your command prompt.
$ npm install -g geocoder-geojson
$ geocode --version
$ geocode --helpQuickstart
import geocoder from 'geocoder-geojson'
geocoder.google('Ottawa, ON')
.then(geojson => console.log(geojson))Supports
Features
| Name | Coverage | Restrictions |
|---|---|---|
| Global | Free & API Key - RateLimit 2500/day | |
| googleReverse | Global | Free & API Key - RateLimit 2500/day |
| mapbox | Global | API Key |
| mapboxReverse | Global | API Key |
| bing | Global | API Key |
| wikdata | Global | Free |
CLI
$ geocode --provider bing "Ottawa ON"
$ geocode -p wikidata --nearest [-75.7,45.4] Ottawa
$ geocode -p google --limit 3 "Ottawa ON"Using jq to filter JSON data
$ geocode -p wikidata --nearest [-75.7,45.4] Ottawa | jq .features[0].id
"Q1930"Roadmap
- Implement all geocoder providers from
Python Geocoder
API
mapbox
Mapbox Provider
https://www.mapbox.com/api-documentation/#geocoding
Parameters
addressstring Location for your searchoptions[MapboxOptions] Mapbox Optionsoptions.access_token[string] Access token or environment variableMAPBOX_ACCESS_TOKENoptions.mode[string] Mode mapbox.places or mapbox.places-permanent (optional, default'mapbox.places')options.country[string] ISO 3166 alpha 2 country codes, separated by commasoptions.proximity[LngLat] Location around which to bias results, given as longitude,latitudeoptions.types[Array<string>] Filter results by one or more type.options.autocomplete[boolean] Whether or not to return autocomplete results. (optional, defaulttrue)options.bbox[BBox] Bounding box within which to limit results, given as minX,minY,maxX,maxYoptions.limit[number] Limit the number of results returned. (optional, default5)
Examples
const geojson = await geocoder.mapbox('Ottawa, ON')Returns Promise<Points> GeoJSON Point FeatureCollection
mapboxReverse
Mapbox Provider (Reverse)
https://www.mapbox.com/api-documentation/#geocoding
Parameters
lnglatLngLat Longitude & Latitude x, yoptions[MapboxOptions] Mapbox Optionsoptions.access_token[string] Access token or environment variableMAPBOX_ACCESS_TOKENoptions.mode[string] Mode mapbox.places or mapbox.places-permanent (optional, default'mapbox.places')options.country[string] ISO 3166 alpha 2 country codes, separated by commasoptions.proximity[LngLat] Location around which to bias results, given as longitude,latitudeoptions.types[Array<string>] Filter results by one or more type.options.autocomplete[boolean] Whether or not to return autocomplete results. (optional, defaulttrue)options.bbox[BBox] Bounding box within which to limit results, given as minX,minY,maxX,maxYoptions.limit[number] Limit the number of results returned. (optional, default1)
Examples
const geojson = await geocoder.mapbox('Ottawa, ON')Returns Promise<Points> GeoJSON Point FeatureCollection
Google Provider
https://developers.google.com/maps/documentation/geocoding
Parameters
addressstring Location for your searchoptions[GoogleOptions] Google Options
Examples
const geojson = await geocoder.google('Ottawa, ON')Returns Promise<Points> GeoJSON Point FeatureCollection
googleReverse
Google Provider (Reverse)
https://developers.google.com/maps/documentation/geocoding
Parameters
lnglatLngLat Longitude & Latitude x, yoptions[GoogleOptions] Google Options
Examples
const geojson = await geocoder.googleReverse([-75.1, 45.1])Returns Promise<Points> GeoJSON Point FeatureCollection
bing
Bing Provider
https://msdn.microsoft.com/en-us/library/ff701714.aspx
Parameters
addressstring Location for your searchoptions[BingOptions] Bing Options
Examples
const geojson = await geocoder.bing('Ottawa, ON')Returns Promise<Points> GeoJSON Point FeatureCollection
wikidata
Wikidata Provider
Parameters
addressstring Location for your searchoptions[Options] Wikidata Options
Examples
const geojson = await geocoder.wikidata('Ottawa')Returns Promise<Points> GeoJSON Point FeatureCollection
request
Generic GET function to normalize all of the requests
Parameters
urlstring URLgeojsonParserfunction Customized function to generate a GeoJSON Point FeatureCollectionparams[Object](default {}) Query Stringoptions[Object](default utils.Options) Options used for HTTP request & GeoJSON Parser function
Returns Promise<Points> Results in GeoJSON FeatureCollection Points
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago