美文网首页gis
PostGIS bucket抽稀结合mvt

PostGIS bucket抽稀结合mvt

作者: YGIS | 来源:发表于2023-02-01 11:23 被阅读0次

参考文章 基于PostGis实现空间点抽稀
由于Cesium渲染mvt功能刚做出来,性能不好,此外设备点空间分布不均匀,渲染卡顿加上密集分布在效果上需要优化,在postGIS生成mvt时加入了抽稀的操作。
结合mvt的Envelope计算width_bucket,由于希望抽稀点有业务属性,没有选择计算中心点st_centroid,而是选取集合中第一个点,联合原表带出其他属性。

select a.geom,a.count,b.sensorname from (
  select 
    --用于分组
    width_bucket(st_x(geom),st_xmin(ST_TileEnvelope(Z,X,Y)),st_xmax(ST_TileEnvelope(Z,X,Y)),20) as grid_x,
    width_bucket(st_y(geom),st_ymin(ST_TileEnvelope(Z,X,Y)),st_ymax(ST_TileEnvelope(Z,X,Y)),20) as grid_y,
    --集合&选点&统计
    ST_GeometryN(st_collect(geom),1) as geom,
    count(geom) 
  from camera 
  where st_intersects(geom,ST_TileEnvelope(Z,X,Y))
  group by grid_x,grid_y) a,
  camera b 
where a.geom&&b.geom;

效果


原数据
分30桶
分20桶

后续可能要优化下效率。

相关文章

网友评论

    本文标题:PostGIS bucket抽稀结合mvt

    本文链接:https://www.haomeiwen.com/subject/cirihdtx.html