Javascript 在Google Maps API中舍入place.geometry.location值
我正在使用谷歌地图API做反向地理编码(地址查找)。我的代码结果非常详细Javascript 在Google Maps API中舍入place.geometry.location值,javascript,php,google-maps-api-3,location,coordinates,Javascript,Php,Google Maps Api 3,Location,Coordinates,我正在使用谷歌地图API做反向地理编码(地址查找)。我的代码结果非常详细Lat Long如下: (-7.79925049999999110.40451239999993) 如何将place.geometry.location结果四舍五入为特定的小数位数 e、 g.(-7.7992505,110.4045124) 这是我的代码方案: 在我的HTML中 <div id="infowindow-content"> <span id="place-
Lat Long
如下:
(-7.79925049999999110.40451239999993)
如何将place.geometry.location结果四舍五入为特定的小数位数
e、 g.(-7.7992505,110.4045124)
这是我的代码方案:
在我的HTML中
<div id="infowindow-content">
<span id="place-coord"></span>
</div>
我曾尝试使用:
place.geometry.location.toUrlValue(precision?:number)
或
并导致一些碰撞
任何帮助都将不胜感激。谢谢精度:数字代码必须替换为整数
place.geometry.location.toUrlValue(WriteYourDesiredPrecisionHere)
在这个问题上,应该是:
place.geometry.location.toUrlValue(7)
你试过toFixed方法吗?
我试过使用:
。。。可能只需要place.geometry.location.toUrlValue(7)
就可以了。谢谢你,杰罗姆
place.geometry.location.toUrlValue(WriteYourDesiredPrecisionHere)
place.geometry.location.toUrlValue(7)