开发者

How to add labels on Google Maps Pinpoints?

开发者 https://www.devze.com 2022-12-23 17:57 出处:网络
Creating a google map with store locations within 50 miles of user entered address. Have map & pinpoints showing correctly but all of the pinpoints just have a dot on them. I\'d like to be able to

Creating a google map with store locations within 50 miles of user entered address. Have map & pinpoints showing correctly but all of the pinpoints just have a dot on them. I'd like to be able to label them A, B, C, D, etc so that I can list out locations & addresses in sidebar.

How would I do this? Here's the code I'm using to add my pinpoints.

    var point = 开发者_开发知识库new GLatLng(latitude, longitude);
            var marker = new GMarker(point);
            GEvent.addListener(marker, "click", function () {
                map.openInfoWindowHtml(point, myHtml);
            });
map.addOverlay(marker);


Excellent, thanks. Included this js library.

http://code.google.com/p/gmaps-utility-library/

And then all I needed to do was update the

var marker = new GMarker(point);

to this

var newIcon = MapIconMaker.createLabeledMarkerIcon({label: "A", primaryColor: "#FD766A"});
var marker = new GMarker(point, {icon: newIcon});
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号