Jimmy
Jimmy

Reputation: 12487

Google maps geocoding - reduce number of decimal place

Although I like the accuracy of google maps, I was wondering how easy it is to modify their jquery code to limit the number of decimal places returned.

Here is the code I am working with: http://jsfiddle.net/Rr5PL/9/

How can it be achieved to have 5 decimal places returned on lat/long instead of ofthe 15 odd that it has at the moment?

Thanks!

Upvotes: 1

Views: 1641

Answers (1)

Try this: http://jsfiddle.net/Rr5PL/11/

$(latval).val(marker.getPosition().lat().toFixed(5));
$(longval).val(marker.getPosition().lng().toFixed(5));

Upvotes: 3

Related Questions