Add numbering label to google map marker

只愿长相守 提交于 2019-11-30 07:45:02

If you don't want to use custom icons for each marker then I suggest looking into creating a label class with the OverlayView and then binding the position to the marker.

Or you could look at using something like: http://github.com/nmccready/google-maps-utility-library-v3-infobox

Alex Angelico

I think a better solution is to use a infoWindow. Something like this:

$(document).ready(function () {
    var golfoMexico = new google.maps.LatLng(20.61536,-87.078975);
    var settings = {
        zoom: 18,
        center: golfoMexico,
        mapTypeControl: true,
        mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
        navigationControl: true,
        navigationControlOptions: {style: google.maps.NavigationControlStyle.ZOOM_PAN},
        mapTypeId: google.maps.MapTypeId.HYBRID
    };

    var map = new google.maps.Map(document.getElementById("map_canvas"), settings);
    var pos1= new google.maps.LatLng(20.61536,-87.078975);
     var infowindow = new google.maps.InfoWindow({
           content: "Casa Stavola F8 II"
         });
    var companyMarker = new google.maps.Marker({ position: pos1, map: map,title:"Casa Stavola F8 II", visible:true});
    infowindow.open(map,companyMarker);
});
Budgie

Check out the example at http://www.geocodezip.com/basic8j.asp?filename=example_number.xml (for V2 of the API). There was also a question here about something similar - How can I create numbered map markers in Google Maps V3?.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!