简体   繁体   English

谷歌地图 API - 标记

[英]Google Maps API - Markers

I'm trying to add markers to a map on my page using Google's Javascript API.我正在尝试使用 Google 的 Javascript API 在我的页面上向 map 添加标记。 I know how to do this simply, just with little marker images in various spots on the map, however, I want this to be a little bit cooler.我知道如何简单地做到这一点,只需在 map 上的各个位置使用少量标记图像,但是,我希望它更酷一点。

I want to place transparent circles (tiny ones), on the map in place of markers, but make it so when they are crowded in one area, they layer on top of each other (obviously), and create a darkening effect, so you can kind of see where things are more crowded at a high level, not just a crazy amount of the same exact image marker (which would look really sloppy and weird).我想在 map 上放置透明圆圈(小圆圈)代替标记,但是当它们拥挤在一个区域时,它们会相互叠加(显然),并产生变暗效果,所以你可以在高层次上看到东西更拥挤的地方,而不仅仅是疯狂数量的相同图像标记(看起来真的很草率和奇怪)。

Have any of you done anything like this before, or should I be approaching this differently?你们中的任何人以前有没有做过这样的事情,或者我应该以不同的方式处理这个问题?

try making it a shadow.试着让它成为一个影子。 Shadows layer on top of each other like your described.像你描述的那样,阴影层层叠叠。 Example:例子:

var shadow = new google.maps.MarkerImage('/images/pin_shadow.png',
    new google.maps.Size(27,30),
    new google.maps.Point(0,0),
    new google.maps.Point(0, 19));

var marker = new google.maps.Marker({
    shadow: shadow,
    (otherproperties here),
});

Let me know if this works.让我知道这个是否奏效。

Kevin凯文

Have a look on that page: http://florent.clairambault.fr/add-a-circle-overlay-to-google-maps-api-v3看看那个页面: http://florent.clairambault.fr/add-a-circle-overlay-to-google-maps-api-v3

I think this is what you want.我想这就是你想要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM