Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have to calculate the length of the shortest path between A (lat1, long1) and B (lat2, long2). But all the solutions I've found do not get a correct result because they only calculate the distance between the nearest vertex of A to the nearest vertex of B.

share|improve this question
How should your solution behave instead of routing from the nearest vertex? What would be the "correct" result for you? – underdark Jan 24 '13 at 16:18
The correct result should also consider the distance between point A and its nearest vertex as well as the distance between point B and its nearest vertex. – Robert Jan 25 '13 at 15:05
That will not change the resulting route though. It will only change the total length of the route. – underdark Jan 25 '13 at 15:26
Sorry perhaps I expressed myself badly. I am interested in having a total length of the route correct! – Robert Jan 26 '13 at 10:31
closest point on vertex + endpoint/startpoint, use those to create inestring, measure and add total length – simplexio Jan 26 '13 at 12:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.