开发者

how to fix the precision for lat/lng?

开发者 https://www.devze.com 2023-03-05 06:28 出处:网络
with the v2 version we can fix the precision with toFixed example: poin开发者_C百科t.y.toFixed(4)

with the v2 version we can fix the precision with toFixed example: poin开发者_C百科t.y.toFixed(4) how can we do with the v3 version ?


toFixed is just JavaScript function - not from Google Maps API.

In API v3 you can do that during LatLng creating:

var latitude  = -25.363882;
var longitude = 131.044922;
var latLng = new google.maps.LatLng(latitude.toFixed(4), longitude.toFixed(4));
0

精彩评论

暂无评论...
验证码 换一张
取 消