|     Blog    |     Wiki    |     Support

Routing with Vector Maps?

Need help, again. I am now moving into doing routing with ThinkGeo. I am using ThinkGeoCloudVectorMapsOverlay with my keys. The staring point and the ending points are x and y. Using Visual Studio Visual Basic how do I do the route and show it on the map. Tried looking a couple of examples but didn’t get very far.

Hi Steven,

If you want to call our cloud routing API please view here:

It’s restful and you just need sent request to server and then shows result in any layer.

In there are some links point to wiki is also helpful.


And I think we have some samples about routing, for example:

Please notice, your ThinkGeoCloudVectorMapsOverlay is for render base layer, it’s not related with your routing, you need put your routing in other layer.

Wish that’s helpful.



Ok, playing around I figured out how to run a route between two x,y’s with the RoutingClient and how to get those results with the RoutingGetRouteResult. I even figured out options with RoutingGetRouteOptions. I am able to see time and distance. I’m using the ThinkGeoCloudVectorMapsOverlay feature to display the map. I use an InMemoryFeatureLayer to place a circle on the maps with “Start” and “End” test above them. That works fine. Now that I have the route result I want to put that route path/line on the map. That’s where I’m getting stuck. Here’s my code I’m trying that doesn’t work.

Private Sub btn_Route_Click(sender As Object, e As EventArgs) Handles btn_Route.Click
    Dim rtgClt As New RoutingClient("Key", "Key")
    Dim rtgOpts As New RoutingGetRouteOptions()
    Dim result As ThinkGeo.Cloud.RoutingGetRouteResult
    Dim f As Feature

    Dim plat As Double = 39.842934
    Dim plon As Double = -75.2415481
    Dim dlat As Double = 39.8444378
    Dim dlon As Double = -75.126497
    Dim sp As New PointShape(plon, plat)
    Dim ep As New PointShape(dlon, dlat)

    'Clear pointLayer

    'Set route options
    rtgOpts.DistanceUnit = DistanceUnit.Mile
    rtgOpts.TurnByTurn = True

    'Run Route
    result = rtgClt.GetRoute({sp, ep}, rtgOpts)
    'Get Route Results
    Dim rMiles As Double = Math.Round(result.RouteResult.Routes.Item(0).Distance, 2)
    Dim rTime As Double = result.RouteResult.Routes.Item(0).Duration.TotalMinutes

    'Add route start point to InMemoryFeatureLayer
    f = New Feature(plon, plat, "Start") With {.Tag = "Start"}
    f.ColumnValues.Add("Place", "Start")
    'Add route end point to InMemoryFeatureLayer
    f = New Feature(dlon, dlat, "End") With {.Tag = "End"}
    f.ColumnValues.Add("Place", "End")

    'Get route line shape from result
    Dim rtLine As LineShape = result.RouteResult.Routes.Item(0).Shape

    'Add route line shape to routing layer

    rLayer.RouteStyle.OuterPen.Color = GeoColors.Red
    pointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColors.Red, 10)

    mOverlay.Layers.Add("pointLayer", pointLayer)

    Map_GeocodeMap.CurrentExtent = pointLayer.GetBoundingBox()

End Sub

Hi Steven,

I build a sample based on your code, it looks works well. (103.3 KB)

Wish that’s helpful.