Google map API marker with letter on map

折月煮酒 提交于 2019-11-30 08:53:40

问题


Is there a way to access the colored markers with a letter from google?

I can only use the red ones with letters like

But I need green markers with a letter like I get it from the directions API from google. Like this one here

Is there a way to access to the colored markers with letter? Or do I have to add the markers to my image folder?


回答1:


You must use :

http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=D|00FF00|000000

chld parameter is the letter you want to appear in your marker.
After the pipe, the first RGB code is the color of the marker, the second is the background color of the marker. The last one is optional.

So you can create your marker like this :

var myPin= new google.maps.MarkerImage("http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=D|00FF00|000000");

and use it like you want !



来源:https://stackoverflow.com/questions/20267428/google-map-api-marker-with-letter-on-map

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