VE Directions

I am using VE to build an itinerary (for directions between points on the itinerary) and it is generating errors for me. Is there a way I can have several different maps on there at the same time with different start and end points and it generate the directions between the start and end points without errors


Answer this question

VE Directions

  • bryanedds

    Can anyone help me
  • Elaine CC

    You can only generate driving directions from one point to another on any given map (no multi-point routing). You can have multiple map controls on a single page, however, and so I think you should be able to generate a different set of driving directions on each map, but I haven't tried that yet.

    What kind of errors are you seeing


  • Paul Hacker

    Here is the code I am using to render the maps, and the error I am getting is...

    Error Link: http://webpages.charter.net/mesposito/error.jpg

    Code:

    Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender

    Dim js As String = ""

    Dim ds As DataSet

    Dim CurrentID As Integer = 0

    Dim i As Integer = 0

    If Not ViewState("Agenda") Is Nothing Then

    ds = ViewState("Agenda")

    Else

    Exit Sub

    End If

    For CurrentID = 0 To ViewState("Totals") - 1

    js = ""

    js &= "<script type='text/javascript'>"

    js &= "var map_" & CurrentID & " = null;"

    js &= "function GetAddresses_" & CurrentID & "(arg) {"

    js &= "var val = arg.split('|');"

    js &= "map_" & CurrentID & " = new VEMap('MyMap_" & CurrentID & "');"

    js &= "map_" & CurrentID & ".LoadMap();"

    'js &= "map_" & CurrentID & ".GetRoute(new VELatLong('' + val[0] + ''', ''' + val[1] + ''), new VELatLong(), null, null, onGotRoute_" & CurrentID & "); }"

    'js &= "map_" & CurrentID & ".GetRoute(new VELatLong(''' + val[0] + ''', ''' + val[1] + '''), new VELatLong(''' + val[2] + ''', ''' + val[3] + '''), null, null, onGotRoute_" & CurrentID & "); }"

    js &= "map_" & CurrentID & ".GetRoute(new VELatLong(val[0], val[1]), new VELatLong(val[2], val[3]), null, null, onGotRoute_" & CurrentID & "); }"

    js &= "function onGotRoute_" & CurrentID & "(route) {"

    js &= "var routeinfo='Route info:\n\n';"

    js &= "routeinfo+='Total distance: ';"

    js &= "routeinfo+= route.Itinerary.Distance+' ';"

    js &= "routeinfo+= route.Itinerary.DistanceUnit+'\n';"

    js &= "var steps=''; "

    js &= "var len = route.Itinerary.Segments.length; "

    js &= "for(var i = 0; i<len ;i++) {"

    js &= "steps+=route.Itinerary.SegmentsIdea.Instruction+' -- (';"

    js &= "steps+=route.Itinerary.SegmentsIdea.Distance+') ';"

    js &= "steps+=route.Itinerary.DistanceUnit+'\n'; }"

    js &= "routeinfo+='Steps:\n'+steps;"

    'js &= "routeinfo+='Steps:\n'+steps; }"

    js &= "alert(routeinfo); }"

    'js &= "document.getElementById('lblDirections_" & CurrentID & "').value = routeinfo; }"

    js &= "</script>"

    Me.Page.ClientScript.RegisterStartupScript(Me.GetType(), "StartScripts_" & CurrentID, js)

    js = ""

    js &= "<script type='text/javascript' defer='defer'>"

    js &= "GetAddresses_" & CurrentID & "(document.getElementById('txtTo_" & CurrentID & "').value + '|' + document.getElementById('txtFrom_" & CurrentID & "').value);"

    js &= "</script>"

    Me.Page.ClientScript.RegisterStartupScript(Me.GetType(), "GetData_" & CurrentID, js)

    'For i = 1 To 1000000 : Next

    Next

    End Sub


  • VE Directions