Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/372.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 在Google Maps API中舍入place.geometry.location值_Javascript_Php_Google Maps Api 3_Location_Coordinates - Fatal编程技术网

Javascript 在Google Maps API中舍入place.geometry.location值

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-

我正在使用谷歌地图API做反向地理编码(地址查找)。我的代码结果非常详细
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)