Node.js module to interface with the Geocoder.ca API
Node.js module to interface with the Geocoder.ca API.
location argument and a
coords. In the case of an error,
Error object. Otherwise,
coords will be populated with
Coords object, with
location can be one of the following:
locateproperty containing one of the above
postalpropery containing a zip or postal code
var Geocoder = require'node-geocoder-ca'Geocodergeocoder =address = '525 Market St, Philadelphia, PA 19106';geocodergeocodeaddressif errthrow err;console.log"%s geocoded to [%d, %d]" address coordslat coordslon;;
Geocoder object is an event emitter. It emits the following events:
resultevent happens whenever geocoding succeeds. It passes a
Coordsobject to any listeners.
errorevent happens whenever there is an error. It passes the
Errorobject to any listeners.
You can choose to skip the
callback on the
geocode() method and listen for events instead.
Warning: this usage is currently untested.
var Geocoder = require'node-geocoder-ca'Geocodergeocoder =address = '525 Market St, Philadelphia, PA 19106';geocodergeocodeaddresson'result' /* ... */on'error' /* ... */ ;