我正在尝试使用SRID(32148)计算两个位置之间的距离 这是我的两点
Point-1:
Lat:46.489767 Long:-119.043221
Point-2:
Lat:47.610902 Long:-122.336422
This网站声明这两点的距离(以英里为单位)是173.388,但是从下面的代码中,我得到的结果是0.00216132093865483
这是我正在使用的代码
employeeloc = modelEmployee.objects.filter(user__first_name="adam")[0].location
employerloc = modelEmployer.objects.filter(user__first_name="adam")[0].location
meters = employerloc.distance(employeeloc)
#Caluclate in miles
dobj = Distance(m=meters)
mi = dobj.mi
这是一个更详细的调试结果附加 为什么我的结果如此不同,有什么建议吗
更新:
我尝试使用srid4326转换位置,但是结果仍然不正确
您似乎使用了lon/lat坐标作为SRID(32148)坐标;你需要改变他们
由于坐标与SRID不匹配,此不正确的查询的结果为3.47m:
此查询将提供预期的173.71 mi结果:
这与这个查询的结果类似:
相关问题 更多 >
编程相关推荐