ST_FilterByM

Name

ST_FilterByM — Filters vertex points based on their m-value

Synopsis

geometry ST_FilterByM ( geometry geom , double precision min , double precision max = null , boolean returnM = false ) ;

Description

Filters away vertex points based on their m-value. Returns a geometry with only vertex points that have a m-value larger or equal to the min value and smaller or equal to the max value. If max-value argument is left out only min value is considered. If fourth argument is left out the m-value will not be in the resulting geometry. If resulting geometry have too few vertex points left for its geometry type an empty geometry will be returned. In a geometry collection geometries without enough points will just be left out silently. If

This function is mainly intended to be used in conjunction with ST_SetEffectiveArea. ST_EffectiveArea sets the effective area of a vertex in it's m-value. With ST_FilterByM it then is possible to get a simplified version of the geometry without any calculations, just by filtering

[Note]

There is a difference in what ST_SimplifyVW returns when not enough points meets the creterias compared to ST_FilterByM. ST_SimplifyVW returns the geometry with enough points while ST_FilterByM returns an empty geometry

[Note]

Note that the retuned geometry might be invalid

[Note]

This function returns all dimensions, also the z and m-value

Availability: 2.5.0

Examples

A linestring is filtered



SELECT ST_AsText(ST_FilterByM(geom,30)) simplified
FROM (SELECT  ST_SetEffectiveArea('LINESTRING(5 2, 3 8, 6 20, 7 25, 10 10)'::geometry) geom) As foo;
-result
         simplified
----------------------------
 LINESTRING(5 2,7 25,10 10)