ThinkGeo.com    |     Blog    |     Wiki    |     Support

Route coordinates

how can i find coordinates in a route to be used in tracking application.

Hi Wael,

Do you means that you need to get the route based on the locations. If so, please try the following steps:

  1. Use the “Routing Index Generator” tools(you can download it from here) to build the routable files.

  2. Create the Routing Engine by the files created in the #1. As shown below:

    ShapeFileFeatureSource featureSource = new shapeFileFeatureSource("XXX.shp"); RtgRoutingSource routingSource = new RtgRoutingSource("XXX.rtg"); RoutingEngine routingEngine = new RoutingEngine(routingSource, featureSource);

  3. Open the Routing Engine.

  4. Call the method GetRoute of Routing Engine as below:

    routingResult = routingEngine.GetRoute(routingLayer.StartPoint, routingLayer.EndPoint, routingLayer.StopPoints);
    

    And then we can access the routingResult.Rout.Vetices property to get the all coordinates.

More information please refer to:
http://wiki.thinkgeo.com/wiki/map_suite_routing_quick_start_guide

If something misunderstood here please provide more information about your real scenario.

Thanks,
Emil

Thanks Emil,

What I mean is that I have lat/long of a tracked assist and I need to know if it is in the route since I have the route data and drawn.

Thanks.

Hi Wael,

Please try the following steps:

  1. Get the route as Emil mentioned before.

  2. Call the contains method for route got in #1 to determine whether contains the target location. The code maybe like below:

    var bufferShape = routingResult.Route.Buffer(distance, GeographyUnit shapeUnit, DistanceUnit distanceUnit);
    bool contains = bufferShape.Contains(targetShape);

Thanks,
Peter