Google Maps Default Icons

天大地大妈咪最大 提交于 2019-12-03 09:47:15

问题


I am trying to get the current default Google Maps Icons.

I am making a program with the Google Maps API and have set my DirectionsRenderer to suppress markers so I can make markers to set the specific icon.

This is my current result:

This is what I had before suppressing the default markers:

Later in my program I will be adding waypoints so I would like to set markers like the ones above with the letter A, B, C, etc. with a different color, (like marker "A", which is green).

I have visited several sites such as:

https://developers.google.com/maps/documentation/javascript/examples/marker-symbol-predefined

https://www.google.com/fusiontables/DataSource?dsrcid=308519#map:id=3

google maps v3 standard icon/shadow names (equiv. of G_DEFAULT_ICON in v2)

The markers these websites tell you to use, do not look the same as the current markers. I am wondering if there is a way to call the current "green marker a" just like in the fusion tables:

If so, how? Thanks!


回答1:


When you take a look at the network-tab of the developer-tools you'll see that the URL for the green marker is:

https://mts.googleapis.com/vt/icon/name=icons/spotlight/spotlight-waypoint-a.png&text=A&psize=16&font=fonts/Roboto-Regular.ttf&color=ff333333&ax=44&ay=48&scale=1
//------------------------------------------------------------------------------------^

The letter may be defined via the text-parameter

(Note: there is also a color-parameter, this parameter is used for the text-color and not for the background of the marker)




回答2:


This post was old. I hope my answer that will help people to do that.

            for (var i = 0; i < listMarkers.length; i++) { //loop markers
                if (listMarkers[i].icon) { // if icon is set
                    listMarkers[i].setIcon(); //set default 
                    break;
                }
            }


来源:https://stackoverflow.com/questions/25368851/google-maps-default-icons

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