0.1.6 • Published 8 years ago

multi-geocoder v0.1.6

Weekly downloads
99
License
MIT
Repository
github
Last release
8 years ago

node-multi-geocoder

NodeJS module for geocoding of address list.

Getting Started

You can install this module using Node Package Manager (npm):

npm install multi-geocoder

Usage

The "geocode" method accepts address array and returns Promises/A+ instance that will be fulfilled with object that has "result" field – GeoJSON FeaturesCollection. And "errors" field contains the array of requests could not be geocoded. You can choose geocode provider or coordinates order with the appropriate option. The following providers are available: "yandex-cache" (default), "yandex", "google".

var MultiGeocoder = require('multi-geocoder'),
    geocoder = new MultiGeocoder({ provider: 'yandex-cache', coordorder: 'latlong' });

geocoder.geocode(['Moscow', 'New York', 'Paris', 'London'])
    .then(function (res) {
        console.log(res);
    });

If you have an array of objects with "address" property or addresses on a deeper level you should overlap the "getText" method of geocode provider as follows:

var MultiGeocoder = require('multi-geocoder'),
    geocoder = new MultiGeocoder({ provider: 'yandex', coordorder: 'latlong' }),
    provider = geocoder.getProvider();

provider.getText = function (point) {
    return point.address;
};

geocoder.geocode([{ address: 'Moscow' }, { address: 'New York' }, { address: 'Paris' }, { address: 'London' }])
    .then(function (res) {
        console.log(res);
    });
0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago