I am using Google Maps API to do Reverse Geocoding (Address Lookup). My code result a extremely detail Lat Long
as:
(-7.799250499999999, 110.40451239999993)
How to round the place.geometry.location result into a certain digit decimals?
e.g. (-7.7992505, 110.4045124)
This is the scheme of my code:
In my HTML
<div id="infowindow-content"> <span id="place-coord"></span> </div>
In my Javascript
... function() { ... infowindowContent.children['place-coord'].textContent = place.geometry.location; ... } ...
I had tried to use:
place.geometry.location.toUrlValue(precision?:number)
or
place.geometry.location.toUrlValue(precision?:7)
and result some crash.
Any helps would be highly appreciated. Thanks
Advertisement
Answer
The precision?:number
code must be replaced by an integer.
place.geometry.location.toUrlValue(WriteYourDesiredPrecisionHere)
in this question, it sould be:
place.geometry.location.toUrlValue(7)