php - Places API returning different precisions for lat and long -
i'm having difficulty dealing precision regarding lat , long coordinates, way recorded in database , returned google. can't seem match them.
i have code below location places autocomplete , noticed it's giving me weird results. lat precision smaller long, makes difficult me round them "6", 1 i'm using in database.
placesautocomplete = new google.maps.places.autocomplete(autocompleteinput, autocompleteoptions); placesautocomplete.bindto('bounds', map); google.maps.event.addlistener(placesautocomplete, 'place_changed', function() { var loc = placesautocomplete.getplace().geometry.location; console.log('lat='+loc.lat()+', long='+loc.lng()); createmarker({ map: map, position:loc, draggable: true }); map.setcenter(loc); }); this prints lat=-22.938508, long=-43.17830300000003
the other events on map (such double-click create marker) works fine , give identical precisions.
Comments
Post a Comment