Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/362.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在谷歌地图上获得六边形,并计算两个六边形之间的距离?_Javascript_Google Maps_Google Maps Api 3 - Fatal编程技术网

Javascript 如何在谷歌地图上获得六边形,并计算两个六边形之间的距离?

Javascript 如何在谷歌地图上获得六边形,并计算两个六边形之间的距离?,javascript,google-maps,google-maps-api-3,Javascript,Google Maps,Google Maps Api 3,我知道如何用经纬度计算两点之间的距离。但现在我有了一个项目,它必须使用sexagesimal计算两点之间的距离,就像这个链接一样。然后用谷歌地图得到sexagesimal,我知道了,但我不知道怎么做。有人知道怎么做吗?谷歌地图上的点通常是十进制格式。您可以使用链接中给出的以下方法将小数点转换为十六进制: 我假设你知道如何从谷歌地图上获取积分。您已经知道如何使用纬度和经度计算距离。用十进制或六进制计算距离会得到相同的答案。您只需要将它从一种形式转换为另一种形式。如果您有任何其他澄清,请告诉我。se

我知道如何用经纬度计算两点之间的距离。但现在我有了一个项目,它必须使用sexagesimal计算两点之间的距离,就像这个链接一样。然后用谷歌地图得到sexagesimal,我知道了,但我不知道怎么做。有人知道怎么做吗?

谷歌地图上的点通常是十进制格式。您可以使用链接中给出的以下方法将小数点转换为十六进制:


我假设你知道如何从谷歌地图上获取积分。您已经知道如何使用纬度和经度计算距离。用十进制或六进制计算距离会得到相同的答案。您只需要将它从一种形式转换为另一种形式。如果您有任何其他澄清,请告诉我。

sexagesimal?也许你是说分钟?。我想从谷歌地图上的某个点获取sexagecimal,比如第一个链接。然后我想用距离而不是分钟来计算这个六边形,就像这个链接一样。是的,实际上是一样的,但是我的项目需要六边形来计算距离。如果点已经是六边形,那么你可以将它们转换成十进制格式。我在上面发布的链接也有从十六进制格式到十进制格式的转换。我不确定你的确切要求是什么。如果你能以更详细的方式来阐述它,我相信其他人会提供帮助。我的项目需要sexagecimal,因为它使用Floyd Warshall算法。我有我的项目手工计算。在你们给我答案之前,我搞不懂如何把纬度和经度转换成六分相。但现在我明白了。
# You have decimal degrees (-73.9874°) instead of degrees, minutes, and seconds (-73° 59’ 14.64")
# The whole units of degrees will remain the same (-73.9874° longitude, start with 73°)
# Multiply the decimal by 60 (0.9874 * 60 = 59.244)
# The whole number becomes the minutes (59’)
# Take the remaining decimal and multiply by 60. (0.244 * 60 = 14.64)
# The resulting number becomes the seconds (14.64"). Seconds can remain as a decimal.
# Take your three sets of numbers and put them together, using the symbols for degrees (°), minutes (’), and seconds (") (-73° 59’ 14.64" longitude)