Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
@eolme/geocoder
Advanced tools
Readme
NodeJS module for geocoding of address list.
You can install this module using Node Package Manager (npm):
npm install multi-geocoder
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);
});
To use Yandex API Geocode Key you should overlap the "getRequestParams" method of geocode provider as follows:
var MultiGeocoder = require('multi-geocoder'),
geocoder = new MultiGeocoder({ provider: 'yandex', coordorder: 'latlong' }),
provider = geocoder.getProvider();
var getRequestParams = provider.getRequestParams;
provider.getRequestParams = function () {
var result = getRequestParams.apply(provider, arguments);
result.key = '_my_api_key_';
return result;
};
geocoder.geocode(['Moscow', 'New York', 'Paris', 'London'])
.then(function (res) {
console.log(res);
});
FAQs
NodeJS module for geocoding of address list
The npm package @eolme/geocoder receives a total of 2 weekly downloads. As such, @eolme/geocoder popularity was classified as not popular.
We found that @eolme/geocoder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.