【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.
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章