kingvafa
11-06-2007, 03:07 AM
Hi all
i am kind of new to mappoint, i need only the total distance between 2 latlong, (driving distance not air milage). i am using php and nuSOAP to call mappoint webserver by xml.
i am calling CalculateRoute but i get lots of information back which i dont use. which is all objects information of my direction.
which some times can be 600kb and it slow down my process alot becasue i only need a double or even int as my total distance.
any idea ???
tfmiltz
11-07-2007, 11:40 AM
I once sought this, prior to having a GIS solution in an object model, but I figured here is a question I CAN answer here -heh.
You can compute this without using MapPoint, but I am not sure 'how' accurate it is considering the earth is not a perfect sphere, then again, I don't know how well MapPoint models the earth 'other' than 'as' a sphere.
Try here
Calculate distance and bearing between two Latitude/Longitude points using Haversine formula in JavaScript (http://www.movable-type.co.uk/scripts/latlong.html)
I unfortunately lack the mathematics to fully comprehend how to derive this computation, but there are plenty of examples of this approach to calculating distance between two lat/lon pairs.
I do wonder if it would be appropriate to offset the distance by the % the earth's radius at the equator on its rotational axis increases to 'fix' the perfect sphere problem with this approach.
To those that have encountered this formula, it will be evident I'm not offering up as creative a solution as some of the black belts here - but glad I can actually help someone for once.
Tim Miltz
Quote yogi Beara I saw recently - good GIS one 'It is important to know where you are going, because you just might not get there if you don't'
Winwaed
11-07-2007, 05:24 PM
That gives the "air distance" ('as the crow flies, or Great Circle distance) - not the road/route mileage.
Richard
Wilfried
11-09-2007, 12:29 PM
Hi,
Hi all
i am kind of new to mappoint, i need only the total distance between 2 latlong, (driving distance not air milage). i am using php and nuSOAP to call mappoint webserver by xml.
i am calling CalculateRoute but i get lots of information back which i dont use. which is all objects information of my direction.
which some times can be 600kb and it slow down my process alot becasue i only need a double or even int as my total distance.
any idea ???
There is a TotalDistance property in the route object. You dont need to parse to all the objects if I recall whell from the top of my head.