我正在使用Google Maps API执行反向地理编码(地址查找)。我的代码产生了非常详细的Lat Long
:
(-7.799250499999999, 110.40451239999993)
如何将place.geometry.location结果舍入到一定的数字小数?
EG (-p.7992505,110.4045124)
这是我的代码方案:
在我的HTML中
<div id="infowindow-content">
<span id="place-coord"></span>
</div>
在我的Javascript中
...
function() {
...
infowindowContent.children['place-coord'].textContent = place.geometry.location;
...
}
...
我试过用:
place.geometry.location.toUrlValue(precision?:number)
要么
place.geometry.location.toUrlValue(precision?:7)
并导致一些崩溃。
任何帮助将受到高度赞赏。谢谢
precision?:number
代码必须替换为整数。
place.geometry.location.toUrlValue(WriteYourDesiredPrecisionHere)
在这个问题上,我应该是:
place.geometry.location.toUrlValue(7)