问题标签 [leaflet.markercluster]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
675 浏览

leaflet - 来自不同叠加层的标记相互聚类

我将 angular-leaflet 与 Leaflet markercluster 插件一起使用(例如,参见http://tombatossals.github.io/angular-leaflet-directive/examples/0000-viewer.html#/layers/overlays-markercluster-example )。

现在我有了三个不同的“clustermarker”类型的叠加层。目前,每个覆盖集群的标记仅具有来自同一覆盖的标记。我希望他们所有人都相互聚集。我怎样才能做到这一点?

0 投票
2 回答
868 浏览

leaflet - L.circleMarker 传单

如何用 L.circleMarker 中的图标替换圆圈

$.getJSON("url", function(stationexits){ exitlayer = L.geoJson(stationexits, { onEachFeature: onEachStation, pointToLayer: function (feature, latlng) { return L.circleMarker(latlng, style_station); } });

0 投票
1 回答
597 浏览

javascript - How to use ui-leaflet and Markercluster to change color of markercluster?

I have to create a non-default markerCluster color. I have checked the API and it seems that they suggest modifying a divIcon after creation (I believe, I am learning Leaflet, ui-leaflet, MarkerCluster all at the same time) to something like this:

https://github.com/Leaflet/Leaflet.markercluster

The way I was populating data was on creation, something closer to this:

which I kinda stole from a similar (and forked break off) site: https://github.com/tombatossals/angular-leaflet-directive/blob/master/examples/0216-layers-overlays-markercluster-example.html I was attempting to add an icon property with separate colors to no avail. I am attempting to change the color when multiple types are clustered together. Any help would be appreciated.

Thanks in advance.

0 投票
1 回答
2003 浏览

javascript - 在 markercluster 组中搜索标记 Leaflet-MarkerCluster

我正在使用Leaflet.markercluster将我的标记聚集在我的Mapbox Map中。将使用json文件填充标记。我需要的只是一个搜索功能,它可以根据搜索字符串弹出必要的标记。我了解Leaflet-search,但无法将它与我的代码集成。我该怎么办?

0 投票
1 回答
1845 浏览

css - 如何为多个markercluster组分配不同的颜色?

我正在使用leaflet.markercluster 插件并让它工作,以便它聚集我的标记。是否可以将特定颜色分配给多个集群组?目前,各个图层组之间的所有集群标记颜色都是相同的,很难区分哪些图层代表哪个。

我想使用默认的 markerCluster 标记样式,但我想为每个组分配不同的背景颜色。

例子:

第 1 组

默认标记 CSS:

0 投票
1 回答
698 浏览

leaflet - 更改所有标记的拖动状态

我正在使用 Leaflet.markercluster 1.0.1

我正在尝试在我的地图上添加按钮,以便用户可以进入“编辑模式”。单击该按钮时,它应该切换所有标记的拖动状态。我真的不知道如何正确实现它,但我写了那个代码

它工作了一段时间,但后来我在 .enable() 上得到了异常

有谁知道任何正确的方法来做到这一点?

提前致谢!

0 投票
1 回答
953 浏览

npm - 使用 mapbox.js 的传单版本通过 npm 安装leaflet.markercluster

我目前安装了 mapbox.js@3.0.1,这取决于leaflet@1.0.2。我想安装一个传单插件leaflet.markercluster@1.0.2,它需要传单1.0.x(我通过mapbox.js拥有)。如何安装 leaflet.marketcluster 并告诉它使用 mapbox 的依赖项查找传单?

0 投票
1 回答
3210 浏览

javascript - TypeError:无法读取未定义的属性“latlng”

我试图在鼠标移动时获取 x,y 坐标。当我尝试获取它时,我遇到了错误。

TypeError:无法在 HTMLDivElement.onmousemove(仪表板:442)的 mouseMove(仪表板:593)处读取未定义的属性“latlng”

0 投票
2 回答
795 浏览

leaflet - 始终显示集群边界

我正在寻找一种方法来使集群的边界永久可见,而不仅仅是在鼠标悬停时。到目前为止,我还没有找到解决方案。我正在为传单使用markercluster插件。我必须插入带有本地带宽信息的数据点。我希望那些聚集在一起,然后区域用特定的颜色勾勒出来。感谢您的支持伙计们:-)

问候马蒂斯

0 投票
2 回答
3860 浏览

angular - Leaflet w/ Leaflet-markercluster in angular 2

我在使用 angular 2 使用leaflet-markercluster 插件实现传单时遇到困难。我之前已经让它在 angularJS 中工作。我对 angular 还是很陌生,希望有人能帮助我理解出了什么问题。我假设与 L 的 javascript 命名空间冲突起主要作用,但我只是不知道如何纠正....

因此地图会显示,单个标记也会显示。但是,聚集标记根本没有出现。

一切都是使用 angular-cli 和 npm 设置的。我必须添加该let L = require('leaflet');行才能L.MarkerClusterGroup()在编译时不产生错误。

这是我正在使用的内容:

包.json:

角-cli.json: