如何更改Google地图标记的颜色? [英] How can I change the color of a Google Maps marker?

查看:143
本文介绍了如何更改Google地图标记的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google地图API来构建一个包含标记的地图,但我希望有一个标记可以与其他标记脱颖而出。我认为最简单的做法是将标记的颜色改为蓝色而不是红色。这是一件简单的事情吗?或者我必须以某种方式创建一个全新的图标?如果我必须创建一个新图标,那么最简单的方法是什么? 解决方案

由于maps v2已被弃用,可能对v3地图感兴趣: https://developers.google.com/maps/ documentation / javascript / markers#simple_icons



对于v2地图:

http://code.google.com/apis/maps/documentation/overlays.html#Icons_overview

您将有一组逻辑执行所有'常规'引脚,另一组逻辑使用定义的新标记执行'特殊'引脚。


I'm using the Google Maps API to build a map full of markers, but I want one marker to stand out from the others. The simplest thing to do, I think, would be to change the color of the marker to blue, instead of red. Is this a simple thing to do or do I have to create a whole new icon somehow? If I do have to create a new icon, what's the easiest way to do that?

解决方案

Since maps v2 is deprecated, you are probably interested in v3 maps: https://developers.google.com/maps/documentation/javascript/markers#simple_icons

For v2 maps:

http://code.google.com/apis/maps/documentation/overlays.html#Icons_overview

You would have one set of logic do all the 'regular' pins, and another that does the 'special' pin(s) using the new marker defined.

这篇关于如何更改Google地图标记的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆