如何更改 Gmap 标记颜色?
我有一个带有不同点的自定义谷歌地图:
Markers[0] = new Array(new GMarker(new GLatLng(45.0, 9.0)), "Location1", "<strong>Address Line</strong><br/>Some information");
Markers[1] = new Array(new GMarker(new GLatLng(45.0, 12.0)), "Location2", "<strong>Address Line</strong><br/>Some information");
等等。
我只是想将标记的颜色从默认的红色更改为红色。即第二个蓝色。
如何做到这一点?
I've a custom google map with different points:
Markers[0] = new Array(new GMarker(new GLatLng(45.0, 9.0)), "Location1", "<strong>Address Line</strong><br/>Some information");
Markers[1] = new Array(new GMarker(new GLatLng(45.0, 12.0)), "Location2", "<strong>Address Line</strong><br/>Some information");
etc.
Simply I want to change the color of the markers from the default red. I.E. the 2nd blue.
How to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这是一个简单的代码,允许谷歌地图使用多种颜色标记,
您必须将标记图像从名为“pointer_image”的文件夹中放入,
更改代码
您可以通过编辑这部分代码来
:--希望这会帮助你,我还提供了数据库,它也在下面-----
here is a simple code that allows multiple color marker for google map
here you have to put your marker image from a folder called "pointer_image"
you can change the marker image by chenging the code
by editing this portion of code :--
hope this will help you ,i am also providing the database thi it also in bellow------
在标记上使用 setImage 方法。
http://gmaps-samples.googlecode.com/svn/trunk/ whackamarker/whackamarker.htm
Use the setImage method on the marker.
http://gmaps-samples.googlecode.com/svn/trunk/whackamarker/whackamarker.htm
您可以在原始标记上放置具有所需颜色的新标记。此处通过示例解释了此技术:http://esa.ilmari.googlepages.com /hellocolorswitch.htm
You can put a new marker with the desired color over the original marker. This technique, with an example, is explained here: http://esa.ilmari.googlepages.com/hellocolorswitch.htm
如果你使用 gmap3 插件,你可以像这个例子一样。
https://gmap3.net/api-marker.html。
您可以像这样使用所有这些颜色和图标,
https://sites.google.com/site /gmapsdevelopment/
if you are using gmap3 plugin you can do like this example.
https://gmap3.net/api-marker.html.
And you can use all these colours and icons like this,
https://sites.google.com/site/gmapsdevelopment/