ST_LocateBetween and M values

Paul Ramsey pramsey at cleverelephant.ca
Mon Jul 8 07:35:59 PDT 2024


Confirmed 
https://trac.osgeo.org/postgis/ticket/5762#ticket

> On Jul 8, 2024, at 7:12 AM, Julien Pilet <julien.pilet at invision.ai> wrote:
> 
> Hi,
> 
> 
> There is some strange behavior with ST_LocateBetween: if used with a 0 offset, it will preserve M values. Otherwise, it will drop them.
> 
> Example:
> 
> 
> select ST_AsText(ST_LocateBetween(ST_AddMeasure('LINESTRING (20 180, 50 20, 100 120, 180 20)', 0, 10), 2,5,0 /* no offset */));
> 
> returns
> 
> MULTILINESTRING M ((34.84090646030401 100.8484988783786 2,50 20 4.042879736523244,67.23509268015012 54.47018536030024 5))
> 
> 
> but
> 
> select ST_AsText(ST_LocateBetween(ST_AddMeasure('LINESTRING (20 180, 50 20, 100 120, 180 20)', 0, 10), 2,5,1 /* non-zero offset */));
> 
> returns
> 
> MULTILINESTRING((35.823778647238335 101.03278741342879,50.43502803016365 23.106124037827087,66.3406654891502 54.9173989558002))
> 
> 
> The correct behavior is to keep M values. Is that a bug?
> 
> What about changing the documentation example on https://postgis.net/docs/ST_LocateBetween.html to drop the offset?
> 
> 
> Regards,
> 
> Julien Pilet
> 
> 



More information about the postgis-users mailing list