[postgis-devel] ST_DimensionRange() ?

Sandro Santilli strk at keybit.net
Wed May 27 10:14:51 PDT 2015

On Wed, May 27, 2015 at 06:51:44PM +0200, RĂ©mi Cura wrote:
> To find max of M :
> --
> SELECT max(ST_M(dmp.geom))
> FROM ST_DumpPoints(geom) AS dmp
> --

 Yes, but that's pretty overkill.

> For the linestring, I don't understand it .

It would let you do:

 SELECT ST_M(ST_EndPoint(ST_DimensionRange(geom)));

You should be able to compare the speed using ST_Envelope:

 SELECT ST_M(ST_EndPoint(ST_ExteriorRing(ST_Envelope(geom))));

but it takes that additional "ExteriorRing" call (if the input
isn't "flat", in which case it returns a linestring anyway).

Actually I think I've proposed in the past to change ST_Expand
to also return a LINESTRING as current ST_Expand working type
does not support anything but X and Y. We could even push further
to make ST_Envelope directly always return the LINESTRING, but
changing behavior like that is always somewhat destructive.


More information about the postgis-devel mailing list