【postgis】抽希函数 st_simplify、ST_SimplifyPreserveTopology

抽希函数。

st_simplify(geometry geom, float distanceTolerance);

第一个参数几何字段,第二个是容差,单位是数据拥有的坐标系单位。比如wgs84,单位就是°。

 

 

 

 

http://www.postgis.net/docs/ST_Simplify.html 

http://www.postgis.net/docs/ST_SimplifyPreserveTopology.html

 ST_SimplifyPreserveTopology对线的处理,没有效果图,因为处理后,线变为了多线,所以没法保存。

ERROR:  Geometry type (LineString) does not match column type (MultiLineString),可以用函数ST_Multi对ST_SimplifyPreserveTopology的处理结果(LineString)进行转换,使之成为MultiLineString。

st_simplify还重载了三个参数,第3个参数,如果为true,相当于加了一个规则,删点会比false少一些,解释看官方文档。

 

来自官方文档:

geometry ST_Simplify(geometry geomA, float tolerance, boolean preserveCollapsed);

The "preserve collapsed" flag will retain objects that would otherwise be too small given the tolerance. For example, a 1m long line simplified with a 10m tolerance. If the preserve flag is given, the line will not disappear. This flag is useful for rendering engines, to avoid having large numbers of very small objects disappear from a map leaving surprising gaps.

 

geometry ST_SimplifyPreserveTopology(geometry geomA, float tolerance);

Returns a "simplified" version of the given geometry using the Douglas-Peucker algorithm. Will avoid creating derived geometries (polygons in particular) that are invalid. Will actually do something only with (multi)lines and (multi)polygons but you can safely call it with any kind of geometry. Since simplification occurs on a object-by-object basis you can also feed a GeometryCollection to this function.

Performed by the GEOS module.
 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值