[postgis-tickets] [PostGIS] #2645: ST_LineInterpolatePoint incorrect output for vertical line

PostGIS trac at osgeo.org
Mon Mar 24 18:42:52 PDT 2014


#2645: ST_LineInterpolatePoint incorrect output for vertical line
------------------------------+---------------------------------------------
 Reporter:  bencaradocdavies  |       Owner:  pramsey      
     Type:  defect            |      Status:  new          
 Priority:  critical          |   Milestone:  PostGIS 2.1.2
Component:  postgis           |     Version:  2.1.x        
 Keywords:                    |  
------------------------------+---------------------------------------------
Changes (by bencaradocdavies):

  * priority:  high => critical
  * type:  enhancement => defect


Comment:

 Paul,

 in my view this is a bug. The documentation clearly states "fraction of
 total linestring length the point has to be located". My understanding of
 "length" is that for Cartesian coordinate systems the length of a line
 segment is the Euclidean distance between the end points, and that the
 length of a LineString is the sum of its constituent segments. If you have
 a different interpretation of "length", that is very surprising to me. You
 are implying that this function should interpolate a point corresponding
 to the fraction of a path in the projection of the linestring into the
 plane containing its first two dimensions.

 Manual calculation in full three dimensions of the example you gives
 results in:

 ST_LineInterpolatePoint('LINESTRING(0 0 0, 0 0.5 0, 0 1 100)', 0.5) ->
 'POINT(0 0.748750015624707 49.75000312494141)'

 This is expected as the length of the first segment is 0.5 and the length
 of the second segment is sqrt(0.5**2 + 100**2) which is a little over 100,
 so the second segment dominates and the interpolated point is close to the
 result for interpolating on the second segment alone. The current
 implementation yields 'POINT(0 0.5 0)'.

 I also suggest that this operation should give results that commute with
 rotation or refection. Ignoring the length contribution of the third
 coordinate when finding the interpolated point will prevent this.

 This is a severe bug that prevents the use of this function for 3D
 geoscience applications. Are other functions affected by similar
 interpretations?

 Kind regards,
 Ben.

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2645#comment:3>
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