Opened 7 years ago

Last modified 7 years ago

#3845 closed enhancement

ST_LocateAlong returns error on poorly measured LRS data — at Version 1

Reported by: pauldzy Owned by: pramsey
Priority: low Milestone: PostGIS 2.3.4
Component: postgis Version: 2.3.x
Keywords: ST_LocateAlong LRS Cc:

Description (last modified by pramsey)

I have an LRS geometry from the USGS NHD dataset whereby the final two points of the line have the same measure values for unknown reasons.

This is incorrect of course but not overly invalid. When running ST_LocateAlong against that final measure I get

ERROR: Zero measure-length line encountered! SQL state: XX000

Ideally I would prefer a more forgiving logic, perhaps return NULL if we consider this line truly invalid or perhaps just look past the duplicate measure to return results. I suppose this could be tied as well to the lack of an LRS geometry validator in PostGIS.

Thanks, Paul

SELECT
ST_LocateAlong(
    ST_GeomFromEWKT('SRID=5070;LINESTRINGM(460845.826402341 773926.724512888 46.31061,460836.315093686 773887.969539204 45.72465,460815.740949801 773767.245317281 43.92644,460817.438766447 773729.386836077 43.37001,460817.438778068 773729.386605209 43.37001)')
   ,43.37001
)

Change History (1)

comment:1 by pramsey, 7 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.