语言
/v1/geo/distance
提供两个纬度/经度对并接收使用半正弦公式计算出的它们之间的距离。 支持公里、英里和海里。 对于地球上的任意两点都是准确的。 无需外部服务呼叫; 计算完全在服务器上运行。
The origin point with lat (-90 to 90) and lng (-180 to 180).
The destination point with lat (-90 to 90) and lng (-180 to 180).
The distance unit for the result.
curl -X POST https://api.botoi.com/v1/geo/distance \ -H "Content-Type: application/json" \ -d '{"from":{"lat":40.7128,"lng":-74.006},"to":{"lat":51.5074,"lng":-0.1278},"unit":"km"}'
计算从用户坐标到数据库中每个位置的距离。 按结果排序以首先显示最接近的选项。 在服务器端运行,因此您不需要 Google 地图 API 密钥。
在确认订单之前,请计算您的仓库和送货地址之间的距离。 如果距离超出您的送货区域,请拒绝或收取附加费。
发送连续的 GPS 航点并对距离进行求和以计算总行程长度。 适用于跑步路线、车队跟踪或骑行应用程序。
Free tier includes 5 requests per minute with no credit card required. Upgrade for higher limits.