如何使用谷歌地图包在node.js中定义纬度和经度?
我尝试使用下面的代码来声明纬度和经度,请参阅: var origin1 但是它抛出 gs has no method 'LatLng' 你能建议我如何定义 LAtLng 吗?
function calculateDistances() {
var gs =require('googlemaps');
//in next line i tried to define LAtLNG it throws gs has no method 'LatLng'
**var origin1 = gs.LatLng(13.125511084202,80.029651635576);**
//Below code i tried in html
var origin2 = new google.maps.LatLng(12.9898593006481,80.2497744326417);;
var destinationA = new google.maps.LatLng(13.125511084202,80.029651635576);;
var destinationB = new google.maps.LatLng(12.9898593006481,80.2497744326417);
var service = new google.maps.DistanceMatrixService();
service.getDistanceMatrix(
{
origins: [origin1, origin2],
destinations: [destinationA, destinationB],
travelMode: google.maps.TravelMode.DRIVING,
unitSystem: google.maps.UnitSystem.METRIC,
avoidHighways: false,
avoidTolls: false
}, callback);
}