openlayers 3 , clustering polygons or linestings

ぃ、小莉子 提交于 2019-12-11 10:54:09

问题


i've been searching for a way to cluster polygons using openlayers 3 but no luck. i've read that clustering only works with points so i'm thinking about editing the ol.source.cluster . so had anyone done it, or got any other solutions?

Kind regards


回答1:


As of openlayers 3.15.0, it is possible to cluster all geometry types using an optional function, geometryFunction. From http://openlayers.org/en/v3.15.0/apidoc/ol.source.Cluster.html:

Function that takes an ol.Feature as argument and returns an ol.geom.Point as cluster calculation point for the feature. When a feature should not be considered for clustering, the function should return null. See ol.geom.Polygon#getInteriorPoint for a way to get a cluster calculation point for polygons.



来源:https://stackoverflow.com/questions/29032383/openlayers-3-clustering-polygons-or-linestings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!