Node.js module to interface with the API Module

Node.js module to interface with the API.

Accepts a location argument and a callback. callback receives two params: err and coords. In the case of an error, err will contain an Error object. Otherwise, coords will be populated with a Geocoder.Coords object, with lat and lon properties.

location can be one of the following:

  • a String with location (eg. __"525 Market St, Philadelphia, PA 19106"__)
  • a String with a zip/postal code (eg. "19106" or __"M4A 2L7"__)
  • a Number with a 5-digit zip code (eg. 19106)
  • an Object containing one of the following:
    • a single locate property containing one of the above
    • a single postal propery containing a zip or postal code
    • the following four properties: addresst, stno, city, and prov

If location is an object, it is converted to a query string and passed directly to the API. See API docs for parameters.

var Geocoder = require('node-geocoder-ca').Geocoder,
    geocoder = new Geocoder(),
    address = '525 Market St, Philadelphia, PA 19106';
geocoder.geocode(address, function(errcoords) {
    if (err) {
        throw err;
    console.log("%s geocoded to [%d, %d]", address,, coords.lon);
  • [x] Basic geocoding
  • [ ] Suggestions on failed geocoding
  • [ ] Reverse geocoding