ST_Simplify
MariaDB starting with 11.7
ST_Simplify was added in MariaDB 11.7.
Syntax
ST_Simplify(g, max_distance)
Description
Takes as input a geometry (g) and a double (max_distance). It applies the Ramer–Douglas–Peucker algorithm on g
and returns the resulting geometry.
The goal of the Douglas-Peucker algorithm is to provide generalized simplifications by returning a geometry that is similar to g
but uses only a subset of points. To perform the simplification, all the vertices that are shorter than max_distance
are removed.
The algorithm may produce self-intersections and therefore result in invalid geometries. ST_IsValid can be used to test validity of the result.
If the max_distance is not positive or is NULL, an ER_WRONG_ARGUMENT will occur.
Examples
SELECT ST_AsText(ST_Simplify(ST_GeomFromText('LINESTRING(0 0,0 2,2 2,2 4,4 4,4 6,6 6)'), 0.5)); +-----------------------------------------------------------------------------------------+ | ST_AsText(ST_Simplify(ST_GeomFromText('LINESTRING(0 0,0 2,2 2,2 4,4 4,4 6,6 6)'), 0.5)) | +-----------------------------------------------------------------------------------------+ | LINESTRING(0 0,0 2,2 2,2 4,4 4,4 6,6 6) | +-----------------------------------------------------------------------------------------+ SELECT ST_AsText(ST_Simplify(ST_GeomFromText('LINESTRING(0 0,0 2,2 2,2 4,4 4,4 6,6 6)'), 1)); +---------------------------------------------------------------------------------------+ | ST_AsText(ST_Simplify(ST_GeomFromText('LINESTRING(0 0,0 2,2 2,2 4,4 4,4 6,6 6)'), 1)) | +---------------------------------------------------------------------------------------+ | LINESTRING(0 0,0 2,2 2,2 4,6 6) | +---------------------------------------------------------------------------------------+
See Also
Comments
Comments loading...
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.