New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

csvgeocode

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csvgeocode - npm Package Compare versions

Comparing version

to
0.0.3

2

package.json
{
"name": "csvgeocode",
"version": "0.0.2",
"version": "0.0.3",
"description": "Bulk geocode addresses in a CSV.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -201,7 +201,7 @@ csvgeocode

Acceptable values are "google", "mapbox", or a custom handler function for a geocoding API response. A custom handler function will get two arguments: the response body and the address being geocoded. It should return an object with `lat` and `lng` properties when successful. Otherwise it should return a string error message, which will be passed to the `failure` event (see below).
Acceptable values are `"google"`, `"mapbox"`, or a custom handler function for a geocoding API response. A custom handler function will get two arguments: the response body and the address being geocoded. It should return an object with `lat` and `lng` properties when successful. Otherwise it should return a string error message, which will be passed to the `failure` event (see below).
**Default:** "google"
Writing your own:
Writing your own could look something like this:

@@ -233,4 +233,4 @@ ```js

}
```
## Events

@@ -269,32 +269,2 @@

## Using a different geocoder
The default values for `url` and `handler` are configured to work with Google's Geocoding API. To use a different geocoding service, supply different values for those two options. For example, if you want to use Mapbox's geocoding API:
```js
csvgeocode("input.csv","output.csv",{
"url": "http://api.tiles.mapbox.com/v4/geocode/mapbox.places/{{a}}.json?access_token=MY_API_KEY",
"handler": mapboxHandler
});
function mapboxHandler(body,address) {
var response = JSON.parse(body);
//Error, return a string
if (response.features === undefined) {
return "[ERROR] "+response.message;
} else if (!response.features.length) {
return "[NO MATCH] "+address;
}
//Success, return a lat/lng object
return {
lat: response.features[0].center[1],
lng: response.features[0].center[0]
};
}
```
## Notes

@@ -301,0 +271,0 @@