Google Maps get the center of coordinates (place label at center of polygon)

后端 未结 4 1285
情深已故
情深已故 2020-12-04 00:05

I use Google maps, I mark areas on the maps like that:

\"enter

 var a         


        
4条回答
  •  既然无缘
    2020-12-04 00:54

    Did you add

    zoom: 10,
    center: myLatlng,
    

    for you Marker Object

    (or)

    // map: an instance of GMap3
    // latlng: an array of instances of GLatLng
    var latlngbounds = new google.maps.LatLngBounds();
    latlng.each(function(n){
       latlngbounds.extend(n);
    });
    map.setCenter(latlngbounds.getCenter());
    map.fitBounds(latlngbounds); 
    

提交回复
热议问题