openlayers 3,将多边形或线条聚类 [英] openlayers 3 , clustering polygons or linestings

查看:227
本文介绍了openlayers 3,将多边形或线条聚类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找一种使用openlayers 3将多边形聚类的方法,但是没有运气.我已经读到聚类仅适用于点,所以我正在考虑编辑ol.source.cluster. 所以有人做过,或者有其他解决方案吗?

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?

亲切的问候

推荐答案

从openlayers 3.15.0开始,可以使用可选函数geometryFunction将所有几何类型聚类.来自 http://openlayers.org/en/v3.15.0/apidoc/ol.source.Cluster.html :

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:

以ol.Feature作为参数并返回ol.geom.Point的函数 要素的聚类计算点.什么时候不应该使用某项功能 如果考虑将其用于群集,则该函数应返回null. 有关获取群集的方法,请参见ol.geom.Polygon#getInteriorPoint 多边形的计算点.

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.

这篇关于openlayers 3,将多边形或线条聚类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆