[geos-devel] Questions about linear referencing

Sean Gillies sean.gillies at gmail.com
Mon Feb 1 11:20:46 EST 2010


On Feb 1, 2010, at 4:31 PM, David Turner wrote:

> On Mon, 2010-02-01 at 11:04 +0100, Sean Gillies wrote:
>> The GEOSProject function returns a numerical value when passed a line
>> string and a point not on the line. If the point is beyond (in some
>> sense) the line's starting point, you get 0.0 (normalized). If the
>> point is past (in some sense) the line's end point, you get 1.0
>> (normalized to the line's length). If the point is otherwise off of
>> the line but not past one of its ends in that sense, you get a value
>> between 0 and 1.
>>
>> Is this intended? The behavior seems like it could get rather
>> unpredictable for anything other than a perfectly straight line.
>
> This comes from the LengthIndexedLine::project method.  That method
> finds the closest point along the geometry to the input point.  That
> closest point could be one of the end points.  Why is this
> unpredictable?

That does seem predictable. I just couldn't tell from the code or docs  
what the intent of the function exactly was. If it's intent is the  
same as ST_line_locate_point from PostGIS, I'm clear.

Thanks,

--
Sean



More information about the geos-devel mailing list