D 2019-02-15T10:44:43.926 L About\sST_Subdivide() U sandro W 2333

ST_Subdivide(): a quick intro

back to index

About ST_Subdivide()

Since version 5.0.0 SpatiaLite supports ST_Subdivide(), an advanced SQL function already available on PostGIS.
The implementation is strictly similar in both Spatial DBMSes because on PostgIS the function is built on the top of the internal lwgeom library, and on SpatiaLite is built on the top of librttopo that simply is a more universal porting of lwgeom outside PostGIS.

A short rationale: processing huge geometries having an impressive number of Vertices (many thousands or even more) is an intrinsically slow process.
Subdividing them into many smaller parts (still preserving full topological consistency) usually helps to restore a satisfying processing speed. This is exactly the intended scope of ST_Subdivide():
  • this function will receive an input geometry (may well be a very huge one).
  • each Linestring or Polygon found within the input geometry will be then processed:
    • all Linestrings or Polygons using a number of Vertices lesser or equal than the given threshold will be returned as they are.
    • but all Linestrings or Polygons using an exceeding number of Vertices will be recursively split, untill they'll be represented by a collection of elementary parts using no more than the required number of vertices.
  • at the end of the process the function will return a collection containing all elementary parts (a MultiLinestring or a MultiPolygon depending on the nature of the input geometry).


back to index
Z 9f50fbe65e58ce250b773563fbfed949