node-geocoder-ca
Node.js module to interface with the Geocoder.ca API
Last updated 7 years ago by inxilpro .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install node-geocoder-ca 
SYNC missed versions from official npm registry.

Geocoder.ca Module

Node.js module to interface with the Geocoder.ca API. Build Status

Usage

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 Geocoder.ca API. See API docs for parameters.

Example

var Geocoder = require('node-geocoder-ca').Geocoder,
	geocoder = new Geocoder(),
	address = '525 Market St, Philadelphia, PA 19106';

geocoder.geocode(address, function(err, coords) {
	if (err) {
		throw err;
	}

	console.log("%s geocoded to [%d, %d]", address, coords.lat, coords.lon);
});

Todo

  • [x] Basic geocoding
  • [ ] Suggestions on failed geocoding
  • [ ] Reverse geocoding

Current Tags

  • 0.1.2                                ...           latest (7 years ago)

5 Versions

  • 0.1.2                                ...           7 years ago
  • 0.1.1                                ...           7 years ago
  • 0.1.0                                ...           7 years ago
  • 0.0.3                                ...           7 years ago
  • 0.0.2                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 7
Dependencies (1)
Dev Dependencies (1)
Dependents (2)

Copyright 2014 - 2016 © taobao.org |