2016-05-05 12 views
0

Ich erstelle neue Google Maps-Marker.Google Maps api MarkerWithLabel Position

//displays[0].Latitude = -22.626111 
    //displays[0].Longitude = -43.227489 
    var marker = new MarkerWithLabel({ 
          position: new google.maps.LatLng(displays[0].Latitude, displays[0].Longitude), 
          map: map, 
          labelContent: 1, 
          labelAnchor: new google.maps.Point(6, 35), 
          labelClass: "map-label", 
          icon: pinSymbol(displays[0].Status) 
         }); 

Und dann Position des Markers immer

//marker.position.lng() 
//-43.22748899999999 
//marker.position.lat() 
//-22.626111 

Warum es nicht gleich? Und wie kann ich damit umgehen kann?

+0

Gleitkommazahlen verhalten sich so. – geocodezip

Antwort

0

Sie können auf diese Weise handhaben:

var latUrl = parseFloat(marker.position.toUrlValue().split(',', 2)[0]); 
    var lngUrl = parseFloat(marker.position.toUrlValue().split(',', 2)[1]); 

Hoffe, es hilft!