All Projects → nchaulet → Node Geocoder

nchaulet / Node Geocoder

Licence: mit
nodejs geocoding library

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Node Geocoder

python-omgeo
OMGeocoder - A python geocoding abstraction layer
Stars: ✭ 34 (-95.75%)
Mutual labels:  geocoder
yelp-camp
A Node.js web application project from the Udemy course - The Web Developer Bootcamp by Colt Steele
Stars: ✭ 36 (-95.5%)
Mutual labels:  geocoder
Geopy
Geocoding library for Python.
Stars: ✭ 3,512 (+339%)
Mutual labels:  geocoder
gazetteer
OSM ElasticSearch geocoder and addresses exporter
Stars: ✭ 93 (-88.37%)
Mutual labels:  geocoder
NominatimGeocoderBackend
UnifiedNlp geocoder backend that uses the OSM Nominatim service
Stars: ✭ 49 (-93.87%)
Mutual labels:  geocoder
Track-Stargazers
Have fun tracking your project's stargazers
Stars: ✭ 38 (-95.25%)
Mutual labels:  geocoder
GoogleMapsHelper
An easy to integrate Model Based Google Maps Helper (SVHTTPClient, AFNetworking) That lets you Geo Code , Reverse Geocode, Get Directions , Places Autocomplete.
Stars: ✭ 21 (-97.37%)
Mutual labels:  geocoder
Geocoder
Geocode addresses to coordinates
Stars: ✭ 566 (-29.25%)
Mutual labels:  geocoder
HerePy
A library that provides a Python interface to the HERE APIs.
Stars: ✭ 73 (-90.87%)
Mutual labels:  geocoder
Gisgraphy
geocoding and geolocalisation webservices for Geonames, Openstreetmap, Openaddresses, Tiger and quattroshapes data
Stars: ✭ 275 (-65.62%)
Mutual labels:  geocoder
PostcodesioR
API wrapper around postcodes.io - free UK postcode lookup and geocoder
Stars: ✭ 36 (-95.5%)
Mutual labels:  geocoder
opencage
🌐 R package for the OpenCage API -- both forward and reverse geocoding 🌐
Stars: ✭ 82 (-89.75%)
Mutual labels:  geocoder
w3w-swift-wrapper
Swift library for what3words REST API.
Stars: ✭ 18 (-97.75%)
Mutual labels:  geocoder
Osmunda
An offline geocode library for android, powered by SQLite, using osm data. 离线地理编码Android库,基于SQLite,使用开放街道地图数据。
Stars: ✭ 37 (-95.37%)
Mutual labels:  geocoder
Geocoder
The most featured Geocoder library written in PHP.
Stars: ✭ 3,774 (+371.75%)
Mutual labels:  geocoder
pinpoint
🌎 A python script for finding your Mac.
Stars: ✭ 56 (-93%)
Mutual labels:  geocoder
geocoder
Google Maps geocoding library for Scala
Stars: ✭ 13 (-98.37%)
Mutual labels:  geocoder
Places
🌐 Turn any <input> into an address autocomplete
Stars: ✭ 5,322 (+565.25%)
Mutual labels:  geocoder
Geo Golang
Go library to access geocoding and reverse geocoding APIs
Stars: ✭ 394 (-50.75%)
Mutual labels:  geocoder
Fccurrentlocationgeocoder
iOS Geocoder for forward geocode and reverse geocode user's current location using a block-based syntax. 📍🌍
Stars: ✭ 268 (-66.5%)
Mutual labels:  geocoder

node-geocoder

Build Status Dependency status npm version

Node library for geocoding and reverse geocoding. Can be used as a nodejs library

Installation (nodejs library)

npm install node-geocoder

Usage example

const NodeGeocoder = require('node-geocoder');

const options = {
  provider: 'google',

  // Optional depending on the providers
  fetch: customFetchImplementation,
  apiKey: 'YOUR_API_KEY', // for Mapquest, OpenCage, Google Premier
  formatter: null // 'gpx', 'string', ...
};

const geocoder = NodeGeocoder(options);

// Using callback
const res = await geocoder.geocode('29 champs elysée paris');

// output :
[
  {
    latitude: 48.8698679,
    longitude: 2.3072976,
    country: 'France',
    countryCode: 'FR',
    city: 'Paris',
    zipcode: '75008',
    streetName: 'Champs-Élysées',
    streetNumber: '29',
    administrativeLevels: {
      level1long: 'Île-de-France',
      level1short: 'IDF',
      level2long: 'Paris',
      level2short: '75'
    },
    provider: 'google'
  }
];

Advanced usage (only google, here, mapquest, locationiq, and opencage providers)

const res = await geocoder.geocode({
  address: '29 champs elysée',
  country: 'France',
  zipcode: '75008'
});

// OpenCage advanced usage example
const res = await geocoder.geocode({
  address: '29 champs elysée',
  countryCode: 'fr',
  minConfidence: 0.5,
  limit: 5
});

// Reverse example

const res = await geocoder.reverse({ lat: 45.767, lon: 4.833 });

// Batch geocode

const results = await geocoder.batchGeocode([
  '13 rue sainte catherine',
  'another address'
]);

// Set specific http request headers:
const nodeFetch = require('node-fetch');

const geocoder = NodeGeocoder({
  provider: 'google',
  fetch: function fetch(url, options) {
    return nodeFetch(url, {
      ...options,
      headers: {
        'user-agent': 'My application <[email protected]>',
        'X-Specific-Header': 'Specific value'
      }
    });
  }
});

Geocoder Providers (in alphabetical order)

  • agol : ArcGis Online Geocoding service. Supports geocoding and reverse. Requires a client_id & client_secret
  • datasciencetoolkit : DataScienceToolkitGeocoder. Supports IPv4 geocoding and address geocoding. Use options.host to specify a local instance
  • freegeoip : FreegeoipGeocoder. Supports IP geocoding
  • geocodio: Geocodio, Supports address geocoding and reverse geocoding (US only)
  • google : GoogleGeocoder. Supports address geocoding and reverse geocoding. Use options.clientIdand options.apiKey(privateKey) for business licence. You can also use options.language and options.region to specify language and region, respectively.
  • here : HereGeocoder. Supports address geocoding and reverse geocoding. You must specify options.apiKey with your Here API key. You can also use options.language, options.politicalView (read about political views here), options.country, and options.state.
  • locationiq : LocationIQGeocoder. Supports address geocoding and reverse geocoding just like openstreetmap but does require only a locationiq api key to be set.
    • For geocode you can use simple q parameter or an object containing the different parameters defined here: http://locationiq.org/#docs
    • For reverse, you can pass over {lat, lon} and additional parameters defined in http://locationiq.org/#docs
    • No need to specify referer or email addresses, just locationiq api key, note that there are rate limits!
  • mapquest : MapQuestGeocoder. Supports address geocoding and reverse geocoding. Needs an apiKey
  • nominatimmapquest: Same geocoder as openstreetmap, but queries the MapQuest servers. You need to specify options.apiKey
  • opencage: OpenCage Geocoder. Aggregates many different open geocoder. Supports address and reverse geocoding with many optional parameters. You need to specify options.apiKey which can be obtained at OpenCage.
  • opendatafrance: OpendataFranceGeocoder supports forward and reverse geocoding in France; for more information, see OpendataFrance API documentation
  • openmapquest : Open MapQuestGeocoder (based on OpenStreetMapGeocoder). Supports address geocoding and reverse geocoding. Needs an apiKey
  • openstreetmap : OpenStreetMapGeocoder. Supports address geocoding and reverse geocoding. You can use options.language and options.email to specify a language and a contact email address.
  • nominatimmapquest: Same geocoder as openstreetmap, but queries the MapQuest servers. You need to specify options.apiKey
  • pickpoint: PickPoint Geocoder. Supports address geocoding and reverse geocoding. You need to specify options.apiKey obtained at PickPoint.
    • As parameter for geocode function you can use a string representing an address like "13 rue sainte catherine" or an object with parameters described in Forward Geocoding Reference.
    • For geocode function you should use an object where {lat, lon} are required parameters. Additional parameters like zoom are available, see details in Reverse Geocoding Reference.
  • smartyStreet: Smarty street geocoder (US only), you need to specify options.auth_id and options.auth_token
  • teleport: Teleport supports city and urban area forward and reverse geocoding; for more information, see Teleport API documentation
  • tomtom: TomTomGeocoder. Supports address geocoding. You need to specify options.apiKey and can use options.language to specify a language
  • virtualearth: VirtualEarthGeocoder (Bing maps). Supports address geocoding. You need to specify options.apiKey
  • yandex: Yandex support address geocoding, you can use options.language to specify language

Http adapter

Http adapter is deprecated, you can now use the fetch to provide your own fetch method compatible with the Fetch API https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API.

Fetch option

With the options.fetch you can provide your own method to fetch data. This method should be compatible with the Fetch API.

This allow you to specify a proxy to use, a custom timeout, specific headers, ...

Formatter

  • gpx : format result using GPX format
  • string : format result to an String array (you need to specify options.formatterPattern key)
    • %P country
    • %p country code
    • %n street number
    • %S street name
    • %z zip code
    • %T State
    • %t state code
    • %c City

More

Playground

You can try node-geocoder here http://node-geocoder.herokuapp.com/

Command line tools

node-geocoder-cli You can use node-geocoder-cli to geocode in shell

Extending node geocoder

You can add new geocoders by implementing the two methods geocode and reverse:

const geocoder = {
    geocode: function(value, callback) { ... },
    reverse: function(query, callback) { var lat = query.lat; var lon = query.lon; ... }
}

You can also add formatter implementing the following interface

const formatter = {
  format: function(data) {
    return formattedData;
  }
};

Contributing

You can improve this project by adding new geocoders.

To run tests just npm test.

To check code style just run npm run lint.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].