[geos-devel] Porting LengthIndexedLine.project?

David Turner novalis at novalis.org
Sat Aug 1 00:02:07 EDT 2009

On Mon, 2009-07-27 at 17:42 -0400, David Turner wrote:
> On Thu, 2009-07-23 at 21:53 +0200, strk wrote:
> > On Thu, Jul 23, 2009 at 11:13:34AM -0400, David Turner wrote:
> > > JTS has a class called LengthIndexedLine with a method "project", which
> > > lets you figure out  the nearest point on a line to a given point.  This
> > > is useful, for instance, if you are trying to figure out what street a
> > > person is on from (possibly slightly inaccurate) GPS observations.
> > > 
> > > http://tsusiatsoftware.net/jts/javadoc/com/vividsolutions/jts/linearref/LengthIndexedLine.html#project(com.vividsolutions.jts.geom.Coordinate)
> > > 
> > > PostGIS calls this function st_line_locate_point.
> > > 
> > > GEOS doesn't seem to have it, even though I was under the impression
> > > that GEOS was merely a port of JTS.  If I port JTS's project function
> > > and related functions such as extractPoint to GEOS, would that patch be
> > > likely to be accepted?  Or am I missing something about the relationship
> > > between JTS and GEOS?
> > 
> > Your patch would be welcome. Make sure to include unit testing please.
> I have a patch.  Unfortunately, I do not yet have unit tests, because I
> cannot find the relevant Java unit tests to port.  I could write my own,
> but it seems like some of the other code uses ported Java unit tests,
> and I want to follow the common practice.
> Can you point me to the Java unit tests?

Just wanted to follow up to be sure this wasn't lost.  The example I'm
looking at, in case I'm missing something, is:


which claims to be:

Ported from JTS junit/algorithm/RobustLineIntersectionTest.java

I assume there are probably similar tests for the linearref stuff, but
the JTS CVS appears to be empty or down or something, and Googling turns
up nothing.  

More information about the geos-devel mailing list