Question

How to select the higher value of the same attribute from multiple joining polylines intersection by intersection?

  • 5 September 2018
  • 6 replies
  • 2 views

Dears,

My purpose is to find routes which connect the pink polylines (by Shortest Path Finder) within the area features to the black marked network elements, taken into consideration one attribute value (_sum, the higher the better) of joining lines of the same network (displayed by green) at every intersection. I have already created a loop, containing two SpatialFilter transformers, where Filter is the pink polyline and the Candidates are the green ones. By using this, I could iterate through the green marked network, but it neither considers the value of '_sum' attribute nor the location of the black network elements.

 

Therefore my question is: how can I spatially select those green lines which hve the highest value of '_sum' attribute in order to form a continuous connection between the black and pink networks?

I hope, my explanation was clear, but let me know if you need additional information.

Every suggestion is very appreciated.

Kind regards,

Niki


6 replies

Userlevel 3
Badge +13

Hi @mecserniki I could use a bit more information, but I think that you need to set the Cost Type By One Attribute (_sum) in the ShortestPathFinder. The From-To features will be from the end nodes of the pink polylines to the intersections of the green and black polylines. Then you'll need to sort for each unique pink polyline and select the path with the highest value.

Hi @mecserniki I could use a bit more information, but I think that you need to set the Cost Type By One Attribute (_sum) in the ShortestPathFinder. The From-To features will be from the end nodes of the pink polylines to the intersections of the green and black polylines. Then you'll need to sort for each unique pink polyline and select the path with the highest value.

Thank you @DanAtSafe for your quick answer. It would be nice to use the Shortest Path Finder outside of the polygons, but for me it's hard to define the 'From-To' connections because there are many intersections by green and black polylines. How should I select the right intersections (which means, that the '_sum' is the highest at that point) to the appropriate end nodes of the pink polylines? So how can I find the correct point pairs, in order to build lines for the 'From-To' input?

 

Userlevel 3
Badge +13
Thank you @DanAtSafe for your quick answer. It would be nice to use the Shortest Path Finder outside of the polygons, but for me it's hard to define the 'From-To' connections because there are many intersections by green and black polylines. How should I select the right intersections (which means, that the '_sum' is the highest at that point) to the appropriate end nodes of the pink polylines? So how can I find the correct point pairs, in order to build lines for the 'From-To' input?

 

Hi @mecserniki I've created a template at https://hub.safe.com/templates/higher_value which uses the TopologyBuilder to find the intersections between the major and minor roads, and also the edges of the polygons on the network. It creates From-To features from these and the paths, then sorts them by polygon to get the shortest path from each polygon to the major road. I'm not sure of what you mean by the '_sum' and the higher value. Please let me know if you have adjusting the workspace for your purpose.

 

Hi @mecserniki I've created a template at https://hub.safe.com/templates/higher_value which uses the TopologyBuilder to find the intersections between the major and minor roads, and also the edges of the polygons on the network. It creates From-To features from these and the paths, then sorts them by polygon to get the shortest path from each polygon to the major road. I'm not sure of what you mean by the '_sum' and the higher value. Please let me know if you have adjusting the workspace for your purpose.

 

Hi @DanAtSafe,

 

 

Thank you very much for spending time on creating the provided template! I have tested it on my sample data, and it worked really fine :) I have just adjusted a bit to consider the '_sum' attribute at the Shortest Path Calculation. I'm sorry for the late explanation of the value of '_sum', but this is a kind of intensity value, showing how many cars use a network element. However, if I think correctly, for the Shortest Path calculation the lower values are considered better, therefore I tried to reverse the '_sum' values by Sorter and Counter transformers for my purposes. It gave a good result.

 

 

Now I have only two remaining questions, if you don't mind.

 

How is it possible to select the shortest path on the other side of the area in order to connect also polygons, and create a closed graph? Please, see by green indication on attached screenshot.

 

How can I improve the performance of the tool in case the sample area is bigger?

 

 

Thank you very much for your answer in advance! I am really grateful for your support!

 

Kind regards,

 

Niki

 

 

 

 

Userlevel 3
Badge +13
Hi @DanAtSafe,

 

 

Thank you very much for spending time on creating the provided template! I have tested it on my sample data, and it worked really fine :) I have just adjusted a bit to consider the '_sum' attribute at the Shortest Path Calculation. I'm sorry for the late explanation of the value of '_sum', but this is a kind of intensity value, showing how many cars use a network element. However, if I think correctly, for the Shortest Path calculation the lower values are considered better, therefore I tried to reverse the '_sum' values by Sorter and Counter transformers for my purposes. It gave a good result.

 

 

Now I have only two remaining questions, if you don't mind.

 

How is it possible to select the shortest path on the other side of the area in order to connect also polygons, and create a closed graph? Please, see by green indication on attached screenshot.

 

How can I improve the performance of the tool in case the sample area is bigger?

 

 

Thank you very much for your answer in advance! I am really grateful for your support!

 

Kind regards,

 

Niki

 

 

 

 

Hi @mecserniki The workspace used the TopologyBuilder to find nodes which were intersections between polygons and roads (to become the From points), and intersections between the major and minor roads (to become the To points.) It should still work with a larger dataset. Can you attach a sample dataset here and your modified workspace?

 

Hi @mecserniki The workspace used the TopologyBuilder to find nodes which were intersections between polygons and roads (to become the From points), and intersections between the major and minor roads (to become the To points.) It should still work with a larger dataset. Can you attach a sample dataset here and your modified workspace?

 

Hi @DanAtSafe,

 

 

I have attached the workspace with my additions as well as a geodatabase, containing 'Probe_Closed_Graph_1_small' (original data), 'Probe_Closed_Graph_1_unsplit_small' (dissolved network elements with 'road_type' attribute), 'ROU_BUA_scope_small' (polygons), 'ShortPathFinder_WithinArea' (shortest path within polygons). This is also a smaller scope of the area to be investigated, which should be extended to a countrywide (Romania) one.

 

Actually, next to '_sum' attribute there is another one which need to be considered at the shortest path calculation ('routing_class'). You can see my operation with these two attributes under 'AttributeManager_2' transformer.

 

 

Thank you very much for your efforts in advance!

 

Kind regards,

 

Niki

 

 

fme.zip

 

Reply