Skip to main content
Question

Shortest path from all points to all other points in my dataset

  • Jan 26, 2025 1:36 PM UTC
  • 18 replies
  • 364 views

ohashkii
Contributor
Forum|alt.badge.img+8

I am trying to find shortest distance from all points in red to all other points in green using network connecting all of them.

 

The point feature has only types (A,B).
Is it possible to have the short path finder to search the path always staring from point A to pint B.

18 replies

geomancer
Evangelist
Forum|alt.badge.img+69
  • Evangelist
  • Jan 27, 2025 1:21 PM UTC

Create a topologically correct network from your lines, and input it to the Network port of the ShortestpathFinder.

Create lines from every point of Type A to every point of Type B, and input them to the From-To port.

The results should give you the paths from every point of Type A to every point of Type B.

See the attached workspace for a working example.

 


ohashkii
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • Jan 28, 2025 1:31 PM UTC

​@geomancer 

Thank you very much indeed.

I ran the attached workspace. As shown on the image I got 63 paths. although I have only 9 destinations.

I was expecting to get only short path 9.

 


geomancer
Evangelist
Forum|alt.badge.img+69
  • Evangelist
  • Jan 28, 2025 2:04 PM UTC

The workspace above returns a line between every point A and every point B. As there are 7 points A and 9 points B, 7*9=63 lines are returned.

If you want to know what point A is nearest to a point B, you can get that information by adding (and setting) a Sorter and a Sampler.

Note: when there are several points A at the same distance from a point B, only one point A is shown in the results.

 


ohashkii
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • Jan 28, 2025 2:38 PM UTC

Thanks,

Is there is anything preventing workspace output to be written to (gdb or CAD).

I have tried but get no feature written. 


geomancer
Evangelist
Forum|alt.badge.img+69
  • Evangelist
  • Jan 28, 2025 2:46 PM UTC

That shouldn't be a problem.

Are any features entering the export file in FME?

Do you get any error messages?


ohashkii
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • Jan 28, 2025 5:12 PM UTC

At the log file 0 feature  is written.


geomancer
Evangelist
Forum|alt.badge.img+69
  • Evangelist
  • Jan 28, 2025 5:21 PM UTC

Does FME show there are features entering the writer?

 


ohashkii
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • Jan 29, 2025 6:40 AM UTC

Yes, 9 features, but when adding them to arcmap no records found and it exit directly. 

I tried your workspace and the same workspace with my own data.

Thaks for your follow, appreciated! 


ohashkii
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • Jan 29, 2025 5:06 PM UTC

​@geomancer ..Thanks


geomancer
Evangelist
Forum|alt.badge.img+69
  • Evangelist
  • Jan 29, 2025 5:15 PM UTC

So it may be a problem with how the features are wrtten to the geodatabase.

What happens when you write the resulting lines to a shapefile? Can that be opened in ArcMap?


ohashkii
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • Jan 29, 2025 5:20 PM UTC

I am out of office.I will try later..but what about your  machine, do you have any issues. 

The other workspace you send early about adjacent attributes works fine.

 


geomancer
Evangelist
Forum|alt.badge.img+69
  • Evangelist
  • Jan 30, 2025 8:18 AM UTC

From my workspaces in this question I can export to DWG without any problems, the DWG file contains the features I exported.

For the geodatabase I exported to 'ESRI Geodatabase (File Geodb Open API)’ and set the Geometry type to geodb_polyline. When I open this geodatabase-folder with FME Data Inspector (I don't use ArcMap) I see all the features I exported with their attributes. 

So no problems on my side.


ohashkii
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • Jan 30, 2025 3:06 PM UTC

​@geomancer 

Thank you very much.you input is remarkable. 

Although the workspace shows features are written inside gdb. Unfortunately ,nothing is written when exploring data at arcmap.,however in cad and shape file no problem.every thing is there.

I have created a small polygons with an ID.

Can l limit the shortpath to searched within each polygon.

BR.

 


ohashkii
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • Jan 31, 2025 2:58 PM UTC

​@geomancer 


geomancer
Evangelist
Forum|alt.badge.img+69
  • Evangelist
  • Feb 3, 2025 9:07 AM UTC

I am certain it is possible. What have you tried?


ohashkii
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • Feb 3, 2025 10:27 AM UTC

I have given all polygons unique ID. Joining all points (A,B) have their unique polygon ID.

I stuck  with setting the approprate parameters  to limit the search condition. 


ohashkii
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • Feb 4, 2025 3:58 PM UTC

​@geomancer 

Sir

Any thoughts or ideas will help.


geomancer
Evangelist
Forum|alt.badge.img+69
  • Evangelist
  • Feb 12, 2025 5:01 PM UTC

It took me some time to think this through.

I think you just need to remove the lines (after intersecting) that cross a polygon boundary, and you can limit the From-To lines to points within the same polygon.

The parts highlighted in orange are new.