[Gdal-dev] How to measure a distance betwen two points on a line
Jose Luis Gomez Dans
josegomez at gmx.net
Thu Nov 8 05:58:24 EST 2007
Hi Gus,
-------- Original-Nachricht --------
> I´m making a python script and i need to measure the distance betwen
> two points on a line ( not the euclidean distance; sometimes there´s a lot
> of points betwen them...). I see the Distance() method but it seems it
> compares the euclidean distance betwen two geometries. Is there any ogr method
> to achieve my goal?
Maybe someone can provide more insight, but my idea would go along the lines of using some sort of geoprocessing to split the bit of line between your two points (you can use getPoint(point_position) to get your point's geometry). In this resulting line, you can then measure its length.
A similar way of doing this (skipping the geoprocessing bit, which might be non-trivial) is to search for your first point (->getPoint(), Equals()?), and copy that into a new line object, adding new points up to your last point of interest. You can then use the
You don't want to use Distance, as that gives you the distance between the geometries, not length along line, which is what you're looking for.
Hopefully, someone more knowledgeable than me will be able to help!
Jose
--
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail
More information about the gdal-dev
mailing list