<% ' get the RoutingProblem object Set rProblem = Map.getRouting().createRoutingProblem() ' set routing stops array Dim stops() : ReDim stops(4) Set stops(0) = new GeoLocation : stops(0).init "Redlands, CA", 34.0528, -117.1531 Set stops(1) = new GeoLocation : stops(1).init "Loma Linda, CA", 34.0484, -117.2629 Set stops(2) = new GeoLocation : stops(2).init "San Bernardino, CA", 34.1214, -117.3046 Set stops(3) = new GeoLocation : stops(3).init "Highland, CA", 34.1282, -117.2106 ' add routing stops For i = 0 To UBound( stops) - 1 Set rStop = Server.CreateObject("RMIMS.RoutingStop") rStop.setStop createPoint( stops(i).x, stops(i).y) rStop.setLabel stops(i).label rProblem.addStop (rStop) Next rProblem.setHighwayPreference 50 rProblem.setWeight rmShortest ' to find quickest use rmQuickest rProblem.setOptimize false ' no optimization Set Routing = Map.getRouting() RouteID = Routing.findRoute((rProblem), true, -1) ' show the route Routing.setRoute RouteID Set r = Routing.getDrivingDirections( RouteID).getExtent() Map.setExtent inflateRect(r, 10) ' increase borders ' print driving directions Set DDirs = Routing.getDrivingDirections( RouteID) Dim DSeg Response.Write( "<p>"&DDirs.getStartText()&"<br>"&vbCrLf) Response.Write( DDirs.getFinishText()&"<br>"&vbCrLf) Response.Write( DDirs.getTotalText()&"<p>"&vbCrLf) For i = 0 To DDirs.getSegmentCount()-1 Set DSeg = DDirs.getSegment( i) Response.Write( (i+1) & ". " & DSeg.getText()+"<br>"&vbCrLf) ' if there is TimeLengthText If DSeg.getSegmentType <> rmArrive AND _ DSeg.getSegmentType() <> rmDepart Then Response.Write( DSeg.getTimeLengthText()&"<br>"&vbCrLf) End If Next Function createPoint(x, y) Dim pt Set pt = Server.CreateObject("RMIMS.GeoPoint") pt.x = x pt.y = y Set createPoint = pt End Function Class GeoLocation Public label Public x Public y Public Function init( ilabel, ilat, ilon) Set proj = Map.getProjection() Set pt = proj.project( ilat, ilon) label = ilabel x = pt.x y = pt.y End Function End Class Function inflateRect(ByRef r, percVal) Dim dx, dy dx = ((r.right - r.left) * percVal) / 100.0 dy = ((r.top - r.bottom) * percVal) / 100.0 r.left = r.left - dx r.top = r.top + dy r.right = r.right + dx r.bottom = r.bottom - dy Set inflateRect = r End Function %> <img src="<%= Map.getMapImageURL(Map.getImageWidth(), Map.getImageHeight(), rmDefault)%>" width="<%=Map.getImageWidth()%>", height="<%=Map.getImageHeight()%>">