Community of MapPoint and Bing Maps Users and Developers
This is a discussion on Route Optimization within the Development forums, part of the MapPoint Desktop Discussion category; We are trying to better understand how to set up MapPoint (or another application) to optimize delivery routes for us. ...
| |||||||
| Today's Posts | Twitter Feed | Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Route Optimization |
| |||
| Re: Route Optimization
Hi, this is a brief example that should get you started. You need for each start / stop / via point a Location object. You can create this Location object by latitude / longitude coordinates, but also with address. Code: // if there was a previous active route then we clear it route.Clear(); // set start point loc = map.GetLocation(Lat, Lon, Alt); wp = route.Waypoints.Add(loc, "Start point"); wp.SegmentPreferences = GeoSegmentPreferences.geoSegmentPreferred; // set waypoints loc = map.GetLocation(Lat, Lon, Alt); wp = route.Waypoints.Add(loc, "a waypoint"); wp.SegmentPreferences = GeoSegmentPreferences.geoSegmentPreferred; // set end point loc = map.GetLocation(Lat, Lon, Alt); wp = route.Waypoints.Add(loc, "the eindpoint"); wp.SegmentPreferences = GeoSegmentPreferences.geoSegmentPreferred; // eventually you can optimize the route route.Waypoints.Optimize(); // set preferred roads route.DriverProfile.set_PreferredRoads(GeoRoadType.geoRoadArterial, 0.1); route.DriverProfile.set_PreferredRoads(GeoRoadType.geoRoadFerry, 0.1); route.DriverProfile.set_PreferredRoads(GeoRoadType.geoRoadInterstate, 0.9); route.DriverProfile.set_PreferredRoads(GeoRoadType.geoRoadOtherHighway, 0.6); route.DriverProfile.set_PreferredRoads(GeoRoadType.geoRoadToll, 0.2); // set preferred speed route.DriverProfile.set_Speed(GeoRoadType.geoRoadArterial, 50); route.DriverProfile.set_Speed(GeoRoadType.geoRoadInterstate, 120); route.DriverProfile.set_Speed(GeoRoadType.geoRoadLimitedAccess, 120); route.DriverProfile.set_Speed(GeoRoadType.geoRoadOtherHighway, 90); route.DriverProfile.set_Speed(GeoRoadType.geoRoadStreet, 50); // set time route.DriverProfile.StartTime = System.DateTime.Now; // finally calculate the route route.Calculate();
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz www.comfortsoftware.be MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| Re: Route Optimization
Hi Wilfried, Thank you for the pointing. Can you tell me how the software would work? Do we need to host a copy of MapPoint on our web server or how does that part work? This is for a new venture we are working on in an effort to help people eat healthier. Check our web site: www.freggies.com We are currently sending our address lists (for delivery) to Google maps but then the driver has to sort them manually. We are hoping for an easier solution where we can have the software optimize the list. Thank you for your additional input- Regards, Jerrod |
| |||
| Re: Route Optimization
Hi, No Mappoint is a desktop program. However you can host an application on a webserver that uses MapPoint embedded, for example to calculate the route. But to view maps and route you need MapPoint on the client machines.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz www.comfortsoftware.be MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| Re: Route Optimization
Wilfried, I know that mappoint allows for the map view and directions to be outputted fairly easily. If we hosted this on our server, couldn't we just do the work of developing the route there and then just feed the results via text or graphic image? Do you know of another solution that would get us to where we need to be? We need to be able to send a starting point and a list of stops and have a result in a list of addresses in order after optimization. Even a graphic image is secondary to just getting the list optimized. Thank you- Jerrod |
| |||
| Re: Route Optimization
Hi, Yes you can calculate all with mappoint on a server machine and send text or graphic output to client machines.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz www.comfortsoftware.be MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| Re: Route Optimization
Wilfried - is there some additional text code needed to accomplish this? if so, can you provide me with a quote to create that for us? i have a copy of MP 2009 that we could load on our server for this use. |
| |||
| Re: Route Optimization
Hi Jerrod, Yes of course. Please contact me on my private email address.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz www.comfortsoftware.be MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| Quote:
Private Sub OBLICZ() Dim objApp As New MapPoint.Application Dim objMap As MapPoint.Map Dim objRoute As MapPoint.Route Dim objLoc1 As MapPoint.Location Dim objLoc2 As MapPoint.Location Set objApp = CreateObject("MapPoint.Application.EU.16") objApp.Visible = False Set objMap = objApp.NewMap Set objRoute = objMap.ActiveRoute Worksheets("Arkusz1").Cells(1, 3).Value = "ODLEGŁOŚĆ (kms)" Worksheets("Arkusz1").Cells(1, 4).Value = "Czas(mins)" Worksheets("Arkusz1").Cells(1, 5).Value = "Koszt(PLN)" NReadRow = 2 Do While Worksheets("Arkusz1").Cells(NReadRow, 2) <> "" 'Locate the 2 points Set objLoc1 = objMap.FindResults(Worksheets("Arkusz1").Cells(NRe adRow, 1)).Item(1) Set objLoc2 = objMap.FindResults(Worksheets("Arkusz1").Cells(NRe adRow, 2)).Item(1) 'Calculate the route objRoute.Waypoints.Add objLoc1 objRoute.Waypoints.Add objLoc2 objRoute.Calculate 'Drive Distance in kms Worksheets("Arkusz1").Cells(NReadRow, 3) = objRoute.Distance 'Drive Time in minutes Worksheets("Arkusz1").Cells(NReadRow, 4) = objRoute.DrivingTime 'Straight Line Distance in kms (as a check) Worksheets("Arkusz1").Cells(NReadRow, 5) = objRoute.Cost objRoute.Clear NReadRow = NReadRow + 1 Loop End Sub Can You add for me to my compilation: use motorways - max national roads - max - 2 fuel consumtion: city - 20 other - 16 cost per liter - 2,20 stop for 30minutes after 3hrs driving I aprecieate a help |
| |||
| Re: Route Optimization
Hi, Code: objroute.DriverProfile.set_PreferredRoads(GeoRoadType.geoRoadInterstate, 0.9); objroute.DriverProfile.set_PreferredRoads(GeoRoadType.geoRoadOtherHighway, 0.6);
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz www.comfortsoftware.be MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
![]() |
| Tags |
| optimization, route |
| ||||
| Posted By | For | Type | Date | |
| A Simple Add-in for MapPoint API Beginners - MapPoint Articles - MP2K Magazine | This thread | Refback | 07-06-2009 10:15 AM | |
| "Excel Basics to Blackbelt": A Reference Text for MapPoint Integration - MapPoint Articles - MP2K Magazine | This thread | Refback | 07-06-2009 10:00 AM | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Route optimization | Lanzo | Bing Maps and MapPoint Web Service | 5 | 09-22-2009 04:17 AM |
| Route Optimization in Bing Maps powered by OnTerra’s free Stop Optimization Service | Johannes Kebeck's Blog | Bing Maps Blogs & Tweets | 0 | 07-01-2009 08:11 AM |
| In using Optimization for a route, is there any wa.... | Anonymous | MapPoint Desktop Discussion | 3 | 11-18-2008 03:38 AM |
| Route Optimization and Stop Time | DorothyJBT | Bing Maps and MapPoint Web Service | 3 | 06-12-2008 04:25 AM |
| Route Optimization | Jeff Smith | MapPoint Desktop Discussion | 0 | 03-23-2005 03:06 PM |