将自定义图标与画布渲染传单一起使用 [英] Use custom icons with canvas rendering leaflet
问题描述
我需要在带有自定义图标的传单地图上绘制数千个点.当我达到大约1500个标记时,使用标准L.marker的性能太慢而无法使用.我尝试使用L.circleMarker在此处解决方案,并且能够绘制成千上万的点具有出色的性能.不幸的是,使用L.circleMarker只能制作不同种类的圆,这不能满足我的要求.我也无法利用聚类,因为没有一种特别好的方法将这些不相关的标记与不同的图标聚类.
I need to draw thousands of points on a leaflet map with custom icons. The performance using the standard L.marker is too slow to be usable when I get to around 1500 markers. I attempted the solution here using L.circleMarker, and I am able to draw thousands of points with stellar performance. Unforunately, with using L.circleMarker I am only able to make different kinds of circles, which does not satisfy my requirements. I am also not able to leverage clustering, since there isn't a particularly good way to cluster these unrelated markers with different icons.
有没有办法在使用自定义图标的同时获得画布渲染的性能优势?
Is there a way to get the performance benefits of canvas rendering while being able to use custom icons?
推荐答案
我制作了一个插件来在画布上渲染标记: https://github.com/francoisromain/leaflet-markers-canvas
I made a plugin to render markers on a canvas: https://github.com/francoisromain/leaflet-markers-canvas
您可以将其与自定义标记一起使用.
You can use it with custom markers.
这篇关于将自定义图标与画布渲染传单一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!