简体   繁体   English

叶片/叶片图中的6百万标记

[英]6 millions of markers in folium/leaflet map

With the MarkerCluster algorithm, it's possible to cluster the nearby markers together, so the map is visually very acceptable. 使用MarkerCluster算法,可以将附近的标记聚在一起,因此在视觉上可以接受地图。

however, I found that the performance and the response of leaflet map decrease with the number of markers inside it. 但是,我发现传单图的性能和响应会随着其中的标记数量而降低。

I still don't understand it but I found people talking about Server-side clustering solution instead of client-side clustering. 我仍然不了解它,但是我发现人们在谈论服务器端群集解决方案,而不是客户端群集。

This durable module project is a solution for big numbers of markers that uses this concept ( Server-side clustering ) in leaflet map. 这个持久的模块项目是在传单地图中使用此概念( 服务器端群集 )的大量标记的解决方案。

My questions are: 我的问题是:

how it is done in leaflet map? 如何在传单地图中完成?
how to make this solution in python at folium maps? 如何在folium maps中的python中实现此解决方案?

Server-side clustering can be accomplished with XHR requests. 服务器端集群可以通过XHR请求完成。

The simplest approach would be to divide your map into squares, and have it switch between single-feature layers and substitute geoJSON/JSON layers using a MAP.on('zoomend', function(e){}); 最简单的方法是将地图划分为正方形,然后在单个功能图层之间切换,并使用MAP.on('zoomend', function(e){});替换geoJSON / JSON图层MAP.on('zoomend', function(e){}); event. 事件。

In an example, if jQuery is available, you can do $.getJSON(SERVER_SIDE_URL, {VARIABLE: 'VALUE'}, function(data){}); 在一个示例中,如果jQuery可用,则可以执行$.getJSON(SERVER_SIDE_URL, {VARIABLE: 'VALUE'}, function(data){}); on zoomend. 在zoomend上。 Here the anonymous function will carry response data. 在这里,匿名函数将携带响应数据。 You can use this data to either create a substitute LayerGroup, or a single Layer, while keeping track of and destroying its predicate. 您可以使用此数据创建替代LayerGroup或单个Layer,同时跟踪并破坏其谓词。

The server's side will need to have access to the full dataset, and be able to either provide JSON for a single feature abstracting those nearby, or a set of features within the radius/square radius of a placeholder. 服务器端将需要访问完整的数据集,并且能够为抽象附近的单个特征或占位符的半径/平方半径内的一组特征提供JSON。

That's the abstract of one option. 那是一个选择的摘要。 Alternatively, there may be market-ready solutions. 替代地,可能有市场就绪的解决方案。 But writing your own should produce a more efficient solution for such a simple task. 但是编写自己的脚本应该为这种简单的任务提供更有效的解决方案。

I find an Opensource solution for leaflet and Mapbox . 我找到传单Mapbox一个开源的解决方案。

it is the SuperCluster project created by the owner of leaflet. 它是由传单所有者创建的SuperCluster项目 it is Server-Side Clustring solution with node.js and Client-Side Clustring with MapBox. 它是带有node.js的服务器端Clustring解决方案和带有MapBox的客户端端 Clustring。

the concept of these algorithme is explained here 这些算法的概念在这里解释

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

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