# How to calculate the shortest path between two points characterized by latitude and longitude with pgrouting?

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.

-
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