最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Google Maps Default Icons - Stack Overflow

programmeradmin1浏览0评论

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:

#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!

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!

Share Improve this question edited May 23, 2017 at 12:02 CommunityBot 11 silver badge asked Aug 18, 2014 at 17:29 user1832583user1832583 4
  • Maybe you'll find here what you are looking for: stackoverflow.com/questions/19142242/… – Dr.Molle Commented Aug 18, 2014 at 19:03
  • @Dr.Molle I believe it's a start, it doesn't look exactly like the new icons though – user1832583 Commented Aug 18, 2014 at 19:09
  • 1 The best one I found was here on this post: stackoverflow.com/questions/17746740/… – Telmo Dias Commented Sep 23, 2015 at 11:32
  • Answered here, with: github.com/Concept211/Google-Maps-Markers – Kevin Commented Jun 2, 2017 at 15:48
Add a comment  | 

2 Answers 2

Reset to default 11

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)

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;
                }
            }
发布评论

评论列表(0)

  1. 暂无评论