PDA

View Full Version : "No ferry" option chooses ferries along route :-/



alex_kuechler
10-14-2011, 08:04 AM
Hi,
I do have two adresses to calculate a route between them. With the route option - segment - quickest the route goes along streets only. This is ok.
But if I choose the segment option preferred roads and set ferries to 0 (dislike) than I get a route using a ferry :-/
Does anyone know about this problem? Is it a real issue or am I doing anything wrong here?
Thanks in advance for your help ...

Cheers
Alex

Using MapPoint 2011 Europe (18.00.29.1200)

Winwaed
10-14-2011, 08:38 AM
Without knowing anything else about your route...

0 would be "strong dislike". The alternative route is probably much worse (ie. a very long way around) or possibly doesn't even exist.

alex_kuechler
10-14-2011, 11:28 AM
Is there anything I can provide you? A strong dislike in the preferred options means "do not use ferries at all" for me. Am I wrong?
Cheers

Eric Frost
10-14-2011, 01:15 PM
Is there anything I can provide you? A strong dislike in the preferred options means "do not use ferries at all" for me. Am I wrong?
Cheers

Yeah, I don't think "strong dislike" is equivalent to "never use" a certain class of road. There may be cases where the only possibility is to use that class of road, maybe that's why they set up the algorithm to not make it possible to completely exclude a certain class of road.

Hey, I don't know how practical this would be for you or how many ferry lines there are, but there is an "Avoided" property which can only be used by Shapes with shapes of type geoShapeRectangle. Check it out in the programming section of the help file. Also, see the topic "Detour around an area" in the help file.

Speaking of which, I just spotted on that page this statement: "You can avoid driving on certain types of roads by setting road-type preferences to Dislike" which contradicts what I said above. Doh! I'm not sure what's going on, but I think the statement is wrong, or at least doesn't appear to be working with ferries, so I would look into drawing Avoidance Polygons at at least one side of each ferry route you want to exclude from consideration when calculating a route. Note that in order to work, the Avoidance polygon must lie over an intersection you wish to exclude. It does not work by simply avoiding part of a line segment, the Avoidance Polygon must cover an intersection.

By the way, why do you avoid water? I know vampires are not supposed to cross moving water. Are you routing for vampires? Do you think there might be a market to develop a routing product catering to vampiric routing constraints?

alex_kuechler
10-29-2011, 11:21 AM
Hi,

thanks for your help so far. I assume "dislike" does not mean "avoid" then :-/ Is there any other way of avoiding certain kind of road types like ferries (except the suggestion with drawing polygons with the avoid property)?

I have a huge table of distances calculated and in most cases a) there is non-ferry route available and b) considering ferries makes all the accounting based on distances more complicated as taking a ferry is in most cases not an option at all (night drives where ferries are closed).

So, what I need is an easy to handle "avoid ferries" option. Dislike in route options is not enough and drawing polygons is in this case too complicated for me. Is there any other property or method or global setting that could possibly help?

Is a complete overview of properties and methods available? There was a MapPoint 2006 SDK with object model and everything else [1]. Is there something similar for MapPoint 2011?

Thanks in advance for your help.
Alex

[1] MapPoint 2006 North America SDK
About the Microsoft MapPoint object model (http://msdn.microsoft.com/en-us/library/aa562314.aspx)

Eric Frost
10-29-2011, 11:37 AM
Yes! Here it is. Microsoft MapPoint North America 2011 SDK (http://msdn.microsoft.com/en-us/library/bb507682.aspx)

They added some stuff to the routing API when MapPoint 2010 came out, but I don't think anything that's going to help you.

Would you want help drawing the polygons? In past projects I would use a combination of MapPoint, MapInfo Pro and some custom import/export routines, so I agree it could be complicated, but unless you are talking about a very large geographic area, the actually digitizing it probably less work than you might think.

How big of an area? What states/countries?

Thanks,
Eric

alex_kuechler
11-17-2011, 02:58 AM
Hi,

thanks for your help. In the end, I'm still unhappy that road preferences supports only "likes"/"dislikes" for the road types and there is no avoid property for specific road types like ferries and toll roads. I'll take this to the wishlist forum ...

I picked up the idea of drawing polygons with avoid property set around the ferry terminals that I know of (take care with some important details, see [1]). Major problem: I don't know in which of my 100.000 already calculated distances a ferry might have been used :-( So I will recalculate either all distances or upon request if one of my users suspect a ferry use ...

Cheers
Alex

[1] Info: Take care with Shape size and Avoided property
http://www.mapforums.com/info-take-care-shape-size-avoided-property-18252.html

alex_kuechler
12-27-2011, 07:45 AM
Hi,

as a follow-up to my "avoid ferries" problem I'd like to share on how to draw the polygons for areas and set them to avoid.

In my VBA source code I defined a sub as following:



Private Sub AddShapeToMap(ByRef sLoc As MapPoint.Location, ByRef sShape As MapPoint.Shape, ByVal sName As String, ByVal sLatitude As Double, ByVal sLongitude As Double, ByVal sWidth As Double, ByVal sHeight As Double)
Set sLoc = oMap.GetLocation(sLatitude, sLongitude)
Set sShape = oMap.Shapes.AddShape(geoShapeRectangle, sLoc, sWidth, sHeight)
sShape.Name = sName
sShape.Avoided = True

End Sub



so I can add my areas simply by using



AddShapeToMap oLocDetour, oShapeDetour, "Weserfähre Blumenthal-Motzen", 53.18081, 8.55898, 0.27, 0.27


In the end I get avoided areas around the ferry routes to make sure only these routes are avoided (see picture). It takes a bit "try and error" to draw the polygon on the right (center) spot using latitude and longitude and with the right size but it works quite well.
In the overall source code I put the call AddShapeToMap right after the application start and object creation to make sure that the areas are always there. When clearing a route (
oRoute.Clear) the ploygons remain on the map (as far as I discovered by try and error), so it is enough to place these polygons once on a map and calculate and clear multiple routes.

In the end, this approach works if you know on which routes a ferry is really used, then you can draw a polygon and set this one to avoid. Now I have to discover the routes where ferries are still used, but I'll do this in a step-by-step approach ...

If you have any questions on this, feel free to post them :-) I'm glad to help ...

Cheers
Alex

Sources
AddShape method - AddShape method (http://msdn.microsoft.com/en-us/library/gg674805.aspx)
Avoided property - Avoided property (http://msdn.microsoft.com/en-us/library/gg662977.aspx)
GetLocation method - GetLocation method (http://msdn.microsoft.com/en-us/library/gg674834.aspx)