[postgis-tickets] [PostGIS] #3845: ST_LocateAlong returns error on poorly measured LRS data

PostGIS trac at osgeo.org
Mon Oct 2 05:39:38 PDT 2017


#3845: ST_LocateAlong returns error on poorly measured LRS data
--------------------------+--------------------------------
  Reporter:  pauldzy      |      Owner:  pramsey
      Type:  enhancement  |     Status:  new
  Priority:  low          |  Milestone:  PostGIS 2.3.4
 Component:  postgis      |    Version:  2.3.x
Resolution:               |   Keywords:  ST_LocateAlong LRS
--------------------------+--------------------------------
Description changed by pramsey:

Old description:

> 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
> )

New description:

 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
 )
  }}}

--

--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3845#comment:1>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list