aldeed:geocoder

v0.3.5Published 10 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

geocoder

A Meteor package that provides the geocoding features of the node-geocoder package with a simple API.

Installation (As of Meteor 0.9.0)

$ meteor add aldeed:geocoder

Installation (Prior to Meteor 0.9.0)

Install using Meteorite:

$ mrt add geocoder

Usage

Geocoding an address is simple. Get a new instance of GeoCoder and then call the geocode method on it, passing in the address string:

server.js:

1var geo = new GeoCoder();
2var result = geo.geocode('29 champs elysée paris');

Note that unlike in the node package, the geocode method is synchronous. This makes it simple to use in a server method. If you prefer to pass a callback as the last argument, you can.

The google service is used by default, but you can set the geocoderProvider option when constructing if you want to use a different provider supported by node-geocoder.

You can also set the httpAdapter option to "https" to use HTTPS.

If you need to specify any of the extra options mentioned in the node-geocoder docs, you can pass those also as options to the constructor.

Examples

server.js:

1// Reverse
2var geo = new GeoCoder({
3  geocoderProvider: "mapquest",
4  httpAdapter: "https",
5  apiKey: 'YOUR_API_KEY'
6});
7var result = geo.reverse(45.767, 4.833);