[Gdal-dev] How to measure a distance betwen two points on a line

Jose Luis Gomez Dans josegomez at gmx.net
Sun Nov 11 11:02:59 EST 2007


Hi,

I had written a reply, but I think I closed the window prior to sending the message. D'ooh!!!

> You can use linestring to one of rectangular system, projecting your
> data to ie. UTM. Then you can use provided Distance function
> based on the Pythagorean Th.

Imagine that the data is already in projected coordinates (UTM, say). I have a points layer with pairs of points, and I have another layer with a number of LINES. The POINTS are coincident with vertices on the lines layer. What I think Gus wants to know is how to measure the distance ALONG the line between those two points. So I guess that you first need to cut the line to go from point A to point B (using some sort of buffer, intersection operation). Then, on that line, you can just use the length() (can't quite remember what the method's exactly called) to work out that length. 

The implementation turns nasty, because you can have many points, and many lines. So you need some sort of algorithm to "return a line between point A and point B". 

I am curious as to the best way to solve this.

Cheers,
Jose
-- 
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser



More information about the gdal-dev mailing list