googlemapsutil
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -45,19 +45,19 @@ /*! | ||
}, | ||
directions: function(origin, destination, options, cb, sensor, isHttps) { | ||
directions.directions(origin, destination, options, cb, sensor, isHttps); | ||
directions: function(origin, destination, options, cb, sensor, isHttps, isRequest) { | ||
directions.directions(origin, destination, options, cb, sensor, isHttps, isRequest); | ||
}, | ||
distancematrix: function(origins, destinations, options, cb, sensor, isHttps) { | ||
distancematrix.distancematrix(origins, destinations, options, cb, sensor, isHttps); | ||
distancematrix: function(origins, destinations, options, cb, sensor, isHttps, isRequest) { | ||
distancematrix.distancematrix(origins, destinations, options, cb, sensor, isHttps, isRequest); | ||
}, | ||
locations: function(locations, options, cb, sensor, isHttps) { | ||
elevation.locations(locations, options, cb, sensor, isHttps); | ||
locations: function(locations, options, cb, sensor, isHttps, isRequest) { | ||
elevation.locations(locations, options, cb, sensor, isHttps, isRequest); | ||
}, | ||
path: function(path, sample, options, cb, sensor, isHttps) { | ||
elevation.path(path, sample, options, cb, sensor, isHttps); | ||
path: function(path, sample, options, cb, sensor, isHttps, isRequest) { | ||
elevation.path(path, sample, options, cb, sensor, isHttps, isRequest); | ||
}, | ||
geocoding: function(address, options, cb, sensor, isHttps) { | ||
geocoding.geocoding(address, options, cb, sensor, isHttps); | ||
geocoding: function(address, options, cb, sensor, isHttps, isRequest) { | ||
geocoding.geocoding(address, options, cb, sensor, isHttps, isRequest); | ||
}, | ||
reverseGeocoding: function(lat, lng, options, cb, sensor, isHttps) { | ||
geocoding.reverseGeocoding(lat, lng, options, cb, sensor, isHttps); | ||
reverseGeocoding: function(lat, lng, options, cb, sensor, isHttps, isRequest) { | ||
geocoding.reverseGeocoding(lat, lng, options, cb, sensor, isHttps, isRequest); | ||
} | ||
@@ -64,0 +64,0 @@ }; |
@@ -37,3 +37,3 @@ /*! | ||
Directions.prototype.directions = function(origin, destination, options, cb, sensor, isHttps, isReqest) { | ||
Directions.prototype.directions = function(origin, destination, options, cb, sensor, isHttps, isRequest) { | ||
if (!origin || !destination) { | ||
@@ -49,3 +49,2 @@ var err = new Error('address is not set'); | ||
var sensor = sensor || 'false'; | ||
var isReqest = isReqest || true; | ||
var params = {}; | ||
@@ -61,3 +60,3 @@ params.origin = this._cvtAddress(origin); | ||
this._request(params, cb, isHttps, isReqest); | ||
this._request(params, cb, isHttps, isRequest); | ||
}; | ||
@@ -64,0 +63,0 @@ |
@@ -19,3 +19,3 @@ /*! | ||
DistanceMatrix.prototype.distancematrix = function(origins, destinations, options, cb, sensor, isHttps, isReqest) { | ||
DistanceMatrix.prototype.distancematrix = function(origins, destinations, options, cb, sensor, isHttps, isRequest) { | ||
if (!origins || !destinations) { | ||
@@ -30,3 +30,2 @@ var err = new Error('address is not set'); | ||
var sensor = sensor || 'false'; | ||
var isReqest = isReqest || true; | ||
var componenturi; | ||
@@ -48,3 +47,3 @@ var param; | ||
this._request(params, cb, isHttps, isReqest); | ||
this._request(params, cb, isHttps, isRequest); | ||
}; | ||
@@ -51,0 +50,0 @@ |
@@ -19,5 +19,4 @@ /*! | ||
Elevation.prototype._elevation = function(locations, path, samples, options, cb, sensor, isHttps, isReqest) { | ||
Elevation.prototype._elevation = function(locations, path, samples, options, cb, sensor, isHttps, isRequest) { | ||
var sensor = sensor || 'false'; | ||
var isRequest = isReqest || true; | ||
var param; | ||
@@ -43,3 +42,3 @@ var params = {}; | ||
this._request(params, cb, isHttps, isReqest); | ||
this._request(params, cb, isHttps, isRequest); | ||
}; | ||
@@ -49,3 +48,3 @@ | ||
Elevation.prototype.locations = function(locations, options, cb, sensor, isHttps, isReqest) { | ||
Elevation.prototype.locations = function(locations, options, cb, sensor, isHttps, isRequest) { | ||
if (!locations) { | ||
@@ -59,6 +58,6 @@ var err = new Error('parameter is not set'); | ||
this._elevation(locations, null, null, options, cb, sensor, isHttps, isReqest); | ||
this._elevation(locations, null, null, options, cb, sensor, isHttps, isRequest); | ||
}; | ||
Elevation.prototype.path = function(path, samples, options, cb, sensor, isHttps, isReqest) { | ||
Elevation.prototype.path = function(path, samples, options, cb, sensor, isHttps, isRequest) { | ||
if (!path || !samples) { | ||
@@ -72,3 +71,3 @@ var err = new Error('parameter is not set'); | ||
this._elevation(null, path, samples, options, cb, sensor, isHttps, isReqest); | ||
this._elevation(null, path, samples, options, cb, sensor, isHttps, isRequest); | ||
}; | ||
@@ -75,0 +74,0 @@ |
@@ -41,5 +41,4 @@ /*! | ||
Geocoding.prototype._geocoding = function(address, latlng, options, cb, sensor, isHttps, isReqest) { | ||
Geocoding.prototype._geocoding = function(address, latlng, options, cb, sensor, isHttps, isRequest) { | ||
var sensor = sensor || 'false'; | ||
var isReqest = isReqest || true; | ||
var params = {}; | ||
@@ -71,6 +70,6 @@ if (address) { | ||
this._request(params, cb, isHttps, isReqest); | ||
this._request(params, cb, isHttps, isRequest); | ||
}; | ||
Geocoding.prototype.geocoding = function(address, options, cb, sensor, isHttps, isReqest) { | ||
Geocoding.prototype.geocoding = function(address, options, cb, sensor, isHttps, isRequest) { | ||
var isComponents = false; | ||
@@ -87,6 +86,6 @@ if (options && options.components) { | ||
} | ||
return this._geocoding(address, null, options, cb, sensor, isHttps, isReqest); | ||
return this._geocoding(address, null, options, cb, sensor, isHttps, isRequest); | ||
}; | ||
Geocoding.prototype.reverseGeocoding = function(lat, lng, options, cb, sensor, isHttps, isReqest) { | ||
Geocoding.prototype.reverseGeocoding = function(lat, lng, options, cb, sensor, isHttps, isRequest) { | ||
if (!lat || !lng) { | ||
@@ -100,3 +99,3 @@ var err = new Error('lat lng is not set'); | ||
var latlng = this._cvtLatLng(lat, lng); | ||
return this._geocoding(null, latlng, options, cb, sensor, isHttps, isReqest); | ||
return this._geocoding(null, latlng, options, cb, sensor, isHttps, isRequest); | ||
}; | ||
@@ -103,0 +102,0 @@ |
{ | ||
"name": "googlemapsutil", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "utility to use google map easily", | ||
@@ -5,0 +5,0 @@ "main": "googlemapsutil.js", |
@@ -14,3 +14,3 @@ googleMapsUtil | ||
- call Directions api | ||
- directions(origin, destination, options, cb, sensor, isHttps); | ||
- directions(origin, destination, options, cb, sensor, isHttps, isRequest); | ||
- parameter | ||
@@ -35,6 +35,7 @@ - origin: origin parameter (required) | ||
- isHttps: https setting (default false) | ||
- isRequest: if this value is false, return generated url(not do http request)(default null) | ||
## [Distance Matrix API](https://developers.google.com/maps/documentation/distancematrix/ "distance matrix") | ||
- call Distance Matrix api | ||
- distancematrix(origins, destinations, options, cb, sensor, isHttps); | ||
- distancematrix(origins, destinations, options, cb, sensor, isHttps, isRequest); | ||
- parameter | ||
@@ -60,6 +61,7 @@ - origins: origin parameter (required) | ||
- isHttps: https setting (default false) | ||
- isRequest: if this value is false, return generated url(not do http request)(default null) | ||
## [Elevation API](https://developers.google.com/maps/documentation/elevation/ "elevation") | ||
### Positional Requests | ||
- locations(locations, options, cb, sensor, isHttps) | ||
- locations(locations, options, cb, sensor, isHttps, isRequest) | ||
- parameter | ||
@@ -78,5 +80,6 @@ - locations: location parameter (required) | ||
- isHttps: https setting (default false) | ||
- isRequest: if this value is false, return generated url(not do http request)(default null) | ||
### Sampled Path Requests | ||
- path(path, samples, options, cb, sensor, isHttps) | ||
- path(path, samples, options, cb, sensor, isHttps, isRequest) | ||
- parameter | ||
@@ -96,6 +99,6 @@ - path: path parameter (required) | ||
- isHttps: https setting (default false) | ||
- isRequest: if this value is false, return generated url(not do http request)(default null) | ||
## [Geocoding API](https://developers.google.com/maps/documentation/geocoding/ "geocoding") | ||
- geocoding(address, options, cb, sensor, isHttps) | ||
- geocoding(address, options, cb, sensor, isHttps, isRequest) | ||
- parameter | ||
@@ -112,5 +115,5 @@ - address: address parameter (required) | ||
- isHttps: https setting (default false) | ||
- isRequest: if this value is false, return generated url(not do http request)(default null) | ||
- reverseGeocoding(lat, lng, options, cb, sensor, isHttps) | ||
- reverseGeocoding(lat, lng, options, cb, sensor, isHttps, isRequest) | ||
- parameter | ||
@@ -127,2 +130,3 @@ - lat: latitude (required) | ||
- isHttps: https setting (default false) | ||
- isRequest: if this value is false, return generated url(not do http request)(default null) | ||
@@ -149,35 +153,42 @@ ## Optional API | ||
## Usage 1 | ||
// call api | ||
var gmaputil = require('googlemapsutil'); | ||
// call api from class object | ||
var cb = function(err, result) { | ||
if (err) { | ||
console.log(err); | ||
} | ||
console.log(result); | ||
}; | ||
// directions api sample | ||
gmaputil.directions('Toronto', 'Montreal'); | ||
gmaputil.directions('Toronto', 'Montreal', {avoid: 'highways', mode: 'bicycling'}); | ||
gmaputil.directions('Toronto', 'Montreal', null, cb); | ||
gmaputil.directions('Toronto', 'Montreal', {avoid: 'highways', mode: 'bicycling'}, cb); | ||
// distance matrix api sample | ||
gmaputil.distancematrix(['Vancouver+BC', 'Seattle'], ['San+Francisco', 'Victoria+BC'], {mode: 'bicycling', language: 'fr-FR'}); | ||
gmaputil.distancematrix(['Vancouver+BC', 'Seattle'], ['San+Francisco', 'Victoria+BC'], {mode: 'bicycling', language: 'fr-FR'}, cb); | ||
// elevation api sample | ||
// locations | ||
gmaputil.locations([{lat:39.7391536, lng:-104.9847034},{lat:36.455556,lng:-116.866667}]); | ||
gmaputil.locations([{lat:39.7391536, lng:-104.9847034},{lat:36.455556,lng:-116.866667}], null, cb); | ||
// this is same with above | ||
gmaputil.locations('39.7391536,-104.9847034|36.455556,-116.866667'); | ||
gmaputil.locations('39.7391536,-104.9847034|36.455556,-116.866667', null, cb); | ||
// path | ||
gmaputil.path([{lat: 36.578581, lng:-118.291994},{lat:36.23998,lng:-116.83171}],3); | ||
gmaputil.path([{lat: 36.578581, lng:-118.291994},{lat:36.23998,lng:-116.83171}],3, null, cb); | ||
// geocoding api sample | ||
// geocoding | ||
gmaputil.geocoding('1600+Amphitheatre+Parkway,+Mountain+View,+CA'); | ||
gmaputil.geocoding('1600+Amphitheatre+Parkway,+Mountain+View,+CA', null, cb); | ||
// geocoding with components filter | ||
gmaputil.geocoding('Torun', {components: {administrative_area:'TX', country:'US'}}); | ||
gmaputil.geocoding('Torun', {components: {administrative_area:'TX', country:'US'}}, cb); | ||
// geocoding components filter only | ||
gmaputil.geocoding(null, {components: {route:'Annegatan', administrative_area:'Helsinki',country:'Finland'}}); | ||
gmaputil.geocoding(null, {components: {route:'Annegatan', administrative_area:'Helsinki',country:'Finland'}}, cb); | ||
// reverse geocoding | ||
gmaputil.reverseGeocoding(40.714224,-73.961452); | ||
gmaputil.reverseGeocoding(40.714224,-73.961452, null, cb); | ||
// change output format | ||
@@ -184,0 +195,0 @@ // xml |
31877
703
252