ThinkGeo.com    |     Documentation    |     Premium Support

Connecting Route Network from Source to Destination automatically

Dear All,

I have one requirement in my application that, I have a GC line with Source and Destination.
And I have many routes around 500 Nautical Miles of that GC line. But I want to Filter/Plot only the routes which are starting from Source and ends in Destination.

For your reference I am attaching screenshot here.

Please help/guide me in this.

Thanks in advance.
Ashok.

Hi Ashok,

Thanks for your question, but it looks we cannot understand your question.

What’s the GC line and what’s your actual question here? Could you please convert the scenario to a GIS question and provide more detail information so we can understand it and help you.

Regards,

Don

Hi Don,

Thanks for your immediate response.

In the attached image, the Green line in middle is GC(Great Circle) line, which is connected from Source to Destination (red points). The Black lines are different routes(connected sigments) available in the 500NM range… But i don’t want to display all the black lines(routes) . I wanted to have only lines starting from Source point to Destination attached lines.

i think this is a Geometric Network layer concept.

I hope you understood my question this time… Please ask me if you still not understand…

Thanks…

Hi Ashok,

Thanks for your description, that looks like airline.

If your target is only shows green line but not shows black line, please view the logic as below:

  1. I think you should have a data source(maybe shape file) record all the red points.
  2. You should have another data source record all the lines include green lines and black lines.

Now you want to find the green lines and only display them.

The simplest way is try to find whether the data have a property which contains its start and end city, so you can easily find all the lines you need, and display them.

I just guess your data only contains shape but not contains any other information. So you can loop all the lines, get its two end points. Do spatial query between each one point in the two end points and all the red city points.

PointShape point;
PointShape point2;
double distance = point.GetDistanceTo(point2, GeographyUnit.DecimalDegree, DistanceUnit.Meter);

Then you can set a range of the distance, if the distance is small than the range, we thought they are the same point.

If two end points are the same one to any point in the red city points list, we thought it’s great circle.

You can add the find great circle into a special collection, for example inmemory featurelayer and directly render this layer.

Wish that’s helpful. If that’s not suitable your scenario, please provide us your sample, so we can help you on that.

Regards,

Don

Hi Don,

First of all Sorry for long gap, since I was busy in some other projects.

Thanks for your valuable reply. And I think I need to explain you still more about this.

Actually that Greenline is Actual flight route and it is fixed… And those Black lines are alternative routes (connected line or sigmets). Here these black sigmets/lines are available as shapefile data. now my main aim is to find and display alternative flight route. In the above picture we have many black sigmets inside the buffer. but i need to display only which are connected from Source (one red point) to Destination (another red point) connected sigmets only.

I hope you understood my requirement.

And my final Output should be something like this…

Thank you,
Ashok

Hi Ashok,

Thanks for your detail post, which help us understand your requirement.

But our map control mainly focus on render data, so the map don’t understand your business logic. If you want to make the map shows the line you want, you need to make sure there is some symbols in your data, the map can know which object need to be rendered follow which style, and which need be ignored.

About the black lines, we know the lines is from route, but we don’t know which passing points need be added, and we don’t know what’s the order of them. If we know the passing points and the order, we can loop all the lines, find the segments and render them on map. I think our routing version cannot handle the scenario like yours.

Any further question or I missed anything please let me know.

Regards,

Ethan

.

Hi Ethan,

Thanks for your valuable reply.

I have tried and achieved something good about this…

Here I used MapsuiteRouting DLL, And by using my ATSroutes.shp and ATS.rtg files I have built a shortest path between two points (Example : MIA to VTK) and its shown below. Please have a look.

You can see shortest route (in violet dark line) and ATSroutes.shp shape file (in black lines)

Here my requirement is… Can I plot more than one shortest paths… my code is here…

ShapeFileFeatureSource featureSource = new ShapeFileFeatureSource(rootPath + @"\ATSRoutes.shp");
RoutingSourceForShortest = new RtgRoutingSource(rootPath + @"\ATS.rtg");
routingEngine = new RoutingEngine(RoutingSourceForShortest, featureSource);
RenderMap();
FindPath();

private void RenderMap()
{
ShapeFileFeatureSource featureSource = new ShapeFileFeatureSource(rootPath + @"\ATSRoutes.shp");
featureSource.Open();
RoutingLayer routingLayer = new RoutingLayer();
LineShape ls1=(featureSource.GetFeaturesByColumnValue(“PointFrom”,“MIA”)[0].GetShape() as MultilineShape).Lines[0];
LineShape ls2 = (featureSource.GetFeaturesByColumnValue(“PointFrom”, “VTK”)[0].GetShape() as MultilineShape).Lines[0];
routingLayer.StartPoint = new PointShape(ls1.Vertices[0]);
routingLayer.EndPoint = new PointShape(ls2.Vertices[0]);
LayerOverlay routingOverlay = new LayerOverlay();
routingOverlay.Layers.Add(“RoutingLayer”, routingLayer);
wfMap.Overlays.Add(“RoutingOverlay”, routingOverlay);
wfMap.Refresh();
}

private void FindPath()
{
RoutingLayer routingLayer = (RoutingLayer)((LayerOverlay)wfMap.Overlays[“RoutingOverlay”]).Layers[“RoutingLayer”];
routingLayer.Routes.Clear();
routingLayer.Routes.Add(routingEngine.GetRoute(routingLayer.StartPoint, routingLayer.EndPoint).Route);
wfMap.Refresh(wfMap.Overlays[“RoutingOverlay”]);
}

Please help me on this…
Thank you,
Ashok

Hi Ashok,

For our routing, it only support shortest or fastest, and some special functions, you can view more detail in this sample:

Return more routing result should be supported in new routing, but this product won’t get release in near months.

Regards,

Ethan

Hi Ethan,

Thanks for your reply.

May I know when can New Routing will release.

And can you provide any idea or code for implementing myself till New Routing release.

Thanks
Ashok

Hi Ashok,

The new routing is still in developing, because many things get changed.

For currently routing, it only support fastest or shortest query is because the routing mainly works for vehicle, the other path for navigation is invalid.

Even for your requirement, I guess the other routing path shouldn’t works well, because you want the other line is totally different with the shortest one, but for our logic, many sections maybe get overlap between two results.

So I think currently routing won’t works well for your scenario if you want get more lines exception the fastest and shortest.

Maybe you can write your original algorithm to calculate that for example AStar or Dijkstra, modify our currently logic should be very complex. And because it’s not an easy problem, you can also contact our sales to get the professional service.

BTW, I think the best way should be find the existing air line data.

Regards,

Ethan

Hi Ethan,

Thank you very much for your ideas/guidance.

Can I get the Drawcore logic of shortest and fastest path using whatever the algorithams. So that I can check how we are finding connected routes… It is more helpful for my code customization.

Thanks
Ashok

Hi Ashok,

Our developer discuss about your question today, because the routing logic is so complex, and it don’t have a function just like the DrawCore in our layers.

And we roll back to see what’s the requirement here, we found the routing cannot solved your requirement.

It looks you want to find some alternative airlines between two cities, but it looks the airline is different with the route on land. It have some special rule and if it’s a alternative airline, generally the stops won’t be more than two cities.

So what you need is arrange the requirement again and then build your custom strategy about how to choice stops, after that you should want to update your data to set level for your airports.

For example, when we don’t choose direct flights, the reason should because the price, or the weather reason. If that’s because price, your strategy need to query the other data source which contains dynamic price for each airline. If that’s because reason, you need to choose as few as possible stops and avoid the bad weather lines.

If you think about this, you can found our routing totally cannot handle the scenario.

If you want to get some suggestion about how to implement that based on our map APIs, I think you can create a polygon or circle between your start point and end point, then loop all the cities in this area, and you can build your custom logic based on your strategy after that. Our map API can help you do spatial query and spatial computation, but the other logic besides that should be complete by your custom code.

If I misunderstand your requirement or you want to get any more suggestion, please feel free to let us know.

Wish that’s helpful.

Regards,

Ethan