美文网首页开源地理大数据
Postgis 矢量切片优化

Postgis 矢量切片优化

作者: 木木111314 | 来源:发表于2021-08-03 18:35 被阅读0次

Postgis生成矢量切片主要使用以下两个方法

SELECT ST_AsMVT(tiletable.*,'dltb1000w',512) as tile  FROM(
SELECT dlbm,ST_AsMVTGeom(ta.shape , ST_Transform(ST_MakeEnvelope(118.125,29.535229562948455,120.9375,31.952162238024957, 4326),4610),512 ) as geom from(
select * from 
dltb1000w where 1=1 and  ST_Intersects(  ST_Transform(ST_MakeEnvelope(118.125,29.535229562948455,120.9375,31.952162238024957, 4326),4610) , shape  )) ta) as tiletable where tiletable.geom is not null

ST_AsMVTGeom |

Synopsis

geometry **ST_AsMVTGeom**(geometry <var class="pdparam" style="color: rgb(153, 0, 0);">geom</var>, box2d <var class="pdparam" style="color: rgb(153, 0, 0);">bounds</var>, integer <var class="pdparam" style="color: rgb(153, 0, 0);">extent=4096</var>, integer <var class="pdparam" style="color: rgb(153, 0, 0);">buffer=256</var>, boolean <var class="pdparam" style="color: rgb(153, 0, 0);">clip_geom=true</var>);

Description

Transform a geometry into the coordinate space of a Mapbox Vector Tile of a set of rows corresponding to a Layer. Makes best effort to keep and even correct validity and might collapse geometry into a lower dimension in the process.

geom is the geometry to transform.

bounds is the geometric bounds of the tile contents without buffer.

extent is the tile extent in tile coordinate space as defined by the specification. If NULL it will default to 4096.

buffer is the buffer distance in tile coordinate space to optionally clip geometries. If NULL it will default to 256.

clip_geom is a boolean to control if geometries should be clipped or encoded as is. If NULL it will default to true.

| ST_AsMVT |

Synopsis

row row data with at least a geometry column.

name is the name of the layer. Default is the string "default".

extent is the tile extent in screen space as defined by the specification. Default is 4096.

geom_name is the name of the geometry column in the row data. Default is the first geometry column.

feature_id_name is the name of the Feature ID column in the row data. If NULL or negative the Feature ID is not set. The first column matching name and valid type (smallint, integer, bigint) will be used as Feature ID, and any subsequent column will be added as a property. JSON properties are not supported.

优化策略

如果通过pg生成切片时间过长可以尝试减少两个函数的extent参数
比如默认是4096,可以改为512 可以明显提高计算速度,同时减少前端消耗

优化前

lALPD26eP1Wb-wnNA2PNBX8_1407_867.png

优化后

image.png

相关文章

  • Postgis 矢量切片优化

    Postgis生成矢量切片主要使用以下两个方法 ST_AsMVTGeom | Synopsis geometry ...

  • 基于 PostGIS 的矢量切片服务器

    基于 PostGIS 的矢量切片服务器 矢量切片简介 矢量切片是 MapBox 定义的一种开放的 矢量地图标准 ,...

  • PostGIS源代码安装指南

    前言 使用PostGIS提供的st_asmvt函数返回MapBox格式的矢量切片时,PostGIS报错missin...

  • postgis计算矢量切片

        没写错,是使用postgis计算出来矢量切片。在这之前先准备一个数据:一个GIS数据表(本例中数据为一百万...

  • 使用postgis发布mvt矢量切片

    若想发布自己矢量切片,除了使用mapbox推荐的工具与geoserver外还能够直接使用postgis+后端程序进...

  • Node + Express + PostGIS 动态矢量切片

    前言 基于 PostGIS 实现空间数据动态矢量切片,提升大规模空间数据的前端渲染流畅度。主要思路为: 根据前端请...

  • 矢量切片解决方案

    1.矢量切片简介   矢量切片是由mapbox组织提出的一种新型矢量数据切片格式,它按照TMS切片规则对矢量数据进...

  • geoserver矢量切片资料整理

    环境搭建 arcsde数据连接 矢量切片制作发布 矢量切片leaflet加载 矢量切片相关概念 相关参考资料: l...

  • DEM数据Mapbox渲染

    数据源 DEM数据 工具 postgis mapbox 思路 DEM数据入库(postgis) 栅格矢量化 网格发...

  • postgis计算矢量切片(二)--按值渲染

    方案背景     今年三月份写了一篇postgis计算矢量切片,参考了网上资料给出了一份很粗糙的相关方案(文章写的...

网友评论

    本文标题:Postgis 矢量切片优化

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