Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-geocoder

Package Overview
Dependencies
Maintainers
1
Versions
119
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-geocoder

node geocoding library, supports google maps, mapquest, open street map, ...

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
52K
decreased by-4.96%
Maintainers
1
Weekly downloads
 
Created
Source

node-geocoder

Build Status

Node library for geocoding and reverse geocoding

Currently in development

Installation

npm install node-geocoder

Usage example

var geocoderProvider = 'google';
var httpAdapter = 'http';
// optionnal
var extra = {
    apiKey: 'YOUR_API_KEY', // for map quest
    formatter: null         // 'gpx', 'string', ...
};

var geocoder = require('node-geocoder').getGeocoder(geocoderProvider, httpAdapter, extra);

geocoder.geocode('29 champs elysée paris', function(err, res) {
    console.log(res);
});

// output :
[{
    latitude: 48.8698679,
    longitude: 2.3072976,
    country: 'France',
    countryCode: 'FR',
    city: 'Paris',
    zipcode: '75008',
    streetName: 'Champs-Élysées',
    streetNumber: '29',
    state: 'Île de France',
    stateCode: 'IDF'
}]

Geocoder Provider

  • google : GoogleGeocoder support address geocoding and reverse geocoding, use extra.clientIdand extra.apiKey(privateKey) for business licence
  • freegeoip : FreegeoipGeocoder support ip geocoding
  • datasciencetoolkit : DataScienceToolkitGeocoder supports ip v4 geocoding and address geocoding
  • openstreetmap : OpenStreetMapGeocoder support address geocoding and reverse geocoding
  • mapquest : MapQuestGeocoder support address geocoding and reverse geocoding need an apiKey

Http adapter

  • http : This adapter uses Http nodejs library (by default)
  • requestify : This adapter uses Requestify library (you need to install requestify)

Formatter

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

More

You can improve this project by adding new geocoders or http adapters.

To run tests just npm test

Extending node geocoder

You can add new geocoders by implementing the two method geocode & reverse:

var geocoder = {
    geocode: function(value, callback) { },
    reverse: function(lat, lng, callback) { }
}

Roadmap

more documentation more provider

Keywords

FAQs

Package last updated on 06 Jan 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc