| | Anonymous 09-10-2004, 07:49 PM I am working on a app that automates the process of getting route distances between zip codes in vb.net. I have code that works, however it is quite slow (26 minutes for 230 records on a fast computer). I am trying to find distances from 41,000 some zip codes per division of my company(3 total), and update a database witht he distance information. I know the speed isn't database related because i have taken out part of the code where it update the database. Here is an example of how i find the route distance.
objRoute = map.ActiveRoute
objRoute.Waypoints.Add(map.FindAddressResults(, , , , div, ).Item(1))
objRoute.Waypoints.Add(map.FindAddressResults(, , , , zip, ).Item(1))
objRoute.Calculate()
distance = objRoute.Distance
This code produces the results I want but it is really slow.
Thanks,
Tony Eric Frost 09-10-2004, 09:09 PM The FindAddressResults, and the Calculate method are both slow.
You only have three "div's", right? Make sure the logic in your code is such that this only runs three times:
FindAddressResults(, , , , div, )
For the zips, you might try FindPlaceResults? I don't know for sure, but you can possibly play around and make that faster.
Finally, do you need road distance? Once you have the lat/lon's, you can do great circle (crow flies) distance calculations directly in VB code without involving MapPoint.
Eric Anonymous 09-15-2004, 08:26 AM I originally went the route of the great circle (crow flies) method, however my company is using this for an estimation for freight. If we ship some where and estimate the freight using crow files and ther is a big lake between each point a freight truck would have to go around the lake, thus making the mileage more. IamRascal 02-19-2005, 03:09 PM I'm working on a similar problem. However I geocode the addresses before I send them to the route locator. It can do roughly 3 a second, I'm still looking for a way to make this faster as I'm processing more than 50K records. More ram is on the way for the box, so I'm hoping that will help some.
any other sugestions are appreciated Winwaed 02-20-2005, 12:11 PM 3 a second is pretty good going in my experience. I usually allow 1 per second.
I'm guessing that your routes are fairly short, and that you're working through the add-in mechanism?
Add-ins run "in-process" which avoids the thread->thread communication overhead.
Distance makes a huge difference as well. My 1 per second is averaged from batch work that can include routes contained within a city, or spanning multiple states.
Closing various MapPoint windows helps, as does minimising it. This removes the re-display overhead.
Richard Anonymous 02-21-2005, 07:39 AM I'm using the API, via the objects model instead of a controller. So no rendering is done for the image. The routes are usually less than 50 miles.
Thanks for the input on processing speed tho. Guess 3/sec isn't that bad.
Thanks,
Chris rskrzydlo 03-07-2005, 11:36 AM I too have started to use mappoint for processing distances with the same frustration over the speed of using the routing. I also need driving distances for freight purposes. I develop network optimization packages that I am embedding this function in. Previous to Mappoint, I used PCMiler with PCMiler Batch and it could process 50,000 records in maybe half an hour. In fact I have one user with a database of over 4 million records containing distances between 2 points, all processed by PC Miler. The downside of this option is that the software cost $3,000 and didn't provide any of the unique mapping capabilities of Mappoint. However, it is an option to consider if your primary goal is the generation of mileages and you can justify the time saving.
Ralph Skrzydlo
www.technologix.ca | |