Add numbering label to google map marker
Asked Answered
S

3

6

May I know how to add numbering label to google map marker using google map api? Just add label, not trying to change the icon. Thank you.

Stevie answered 25/8, 2010 at 2:43 Comment(1)
i don't understand. What is this label you speak of? Do you have an example?Burlesque
D
5

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

Dyke answered 26/8, 2010 at 2:14 Comment(1)
The link is broken. Fortunately the repo has been copied to GitHub: github.com/nmccready/google-maps-utility-library-v3-infoboxChalone
F
3

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);
});
Firstfoot answered 30/10, 2013 at 18:15 Comment(0)
F
0

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?.

Fortyniner answered 25/8, 2010 at 10:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.