在 node.js 中查找两个地理点(lats,longs)之间距离的最佳方法
Best way to find distance between two geopoints(lats, longs) in node.js
任何人都可以告诉我在 node.js 中找到两个地理点(lats,longs)之间距离的最佳方法是什么。如果有任何好的节点 js 库请告诉我。我也不想找到直线路径我想找到位置之间可能的行驶路径。
提前致谢
你应该试试geopoint (https://www.npmjs.com/package/geopoint)
为了测量从 point1 到 point2 的距离,使用
`
var GeoPoint = require('geopoint');
point1 = new GeoPoint(lat1, long1);
point2 = new GeoPoint(lat2, long2);
var distance = point1.distanceTo(point2, true)//output in kilometers
`
好的,根据你上次的措辞,你需要一个像Google Distance Matrix API or The Google Directions API. For example: Google Distance Matrix API for Node.js这样的服务的包装器:
任何人都可以告诉我在 node.js 中找到两个地理点(lats,longs)之间距离的最佳方法是什么。如果有任何好的节点 js 库请告诉我。我也不想找到直线路径我想找到位置之间可能的行驶路径。
提前致谢
你应该试试geopoint (https://www.npmjs.com/package/geopoint) 为了测量从 point1 到 point2 的距离,使用
`
var GeoPoint = require('geopoint');
point1 = new GeoPoint(lat1, long1);
point2 = new GeoPoint(lat2, long2);
var distance = point1.distanceTo(point2, true)//output in kilometers
`
好的,根据你上次的措辞,你需要一个像Google Distance Matrix API or The Google Directions API. For example: Google Distance Matrix API for Node.js这样的服务的包装器: