# [geos-devel] Re: [GEOS] #323: A point interpolated from a line does not always intersect the same line

GEOS geos-trac at osgeo.org
Sat Jan 30 22:30:31 EST 2010

```#323: A point interpolated from a line does not always intersect the same line
--------------------------+-------------------------------------------------
Reporter:  starsareblue  |        Owner:  geos-devel at lists.osgeo.org
Type:  defect        |       Status:  reopened
Priority:  major         |    Milestone:
Component:  Default       |      Version:  3.2.0
Severity:  Unassigned    |   Resolution:
Keywords:                |
--------------------------+-------------------------------------------------
Changes (by starsareblue):

* status:  closed => reopened
* resolution:  invalid =>

Comment:

That is true, but in the following case, the projection point (0, -1) is
exactly representable.  Is it perhaps an issue with the MultiLineString?

I would expect the intersection of the following MultiLineString with
the Point to produce either (0, -1) or (1, 0) but instead it produces
(-1, 1).  The distance() function works correctly though.  So
interpolation/projection onto a MultiLineString must be done manually
for now for each individual LineString.

{{{
import shapely.geometry as g
point = g.Point(1, 0)
l1 = g.LineString([(0, 2), (0,0)])
l2 = g.LineString([(-1, 1), (1, 1)])
m = g.MultiLineString([l1.coords, l2.coords])
assert m.interpolate(m.project(point)).coords == (-1, 1) # True, but
wrong
assert m.interpolate(m.project(point)).coords == (0, -1) # Fails
assert m.interpolate(m.project(point)).coords == (1, 0) # Fails
}}}

--
Ticket URL: <http://trac.osgeo.org/geos/ticket/323#comment:2>
GEOS <http://geos.refractions.net/>
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite (JTS).
```