1

I have feature classes of lines (roads) and two types of point feature classes (let’s call them “sources” and “sinks”; there are many sinks for every source). For every source, I need to trace the paths to its nearest sinks such that each path has an attribute for length and a count of the sinks it serves. Normally, it would be possible to do this with the Network Analyst extension in ArcGIS (correct me if I’m wrong), but I currently do not have access to that extension. What are some other tools with which one can accomplish this? Can this be done in QGIS or GRASS GIS? Or does anyone know whether the OSMnx package in Python can be used for this, and can the result be exported to ArcGIS? I know that this has already been discussed here, but I wonder if anything has changed since that discussion.

Vince
  • 20,017
  • 15
  • 45
  • 64
Borillar0821
  • 91
  • 1
  • 7
  • You could explore the use of the python module networkx which can be run in ArcGIS environment? – Hornbydd Jun 27 '21 at 18:38
  • Thanks! I'll look into using the networkx module. – Borillar0821 Jun 29 '21 at 17:46
  • Can networkx really be run in ArcGIS environment? Don't they require different versions of Python (3.6 or higher for networkx, while ArcGIS on my computer runs on Python 2.7.3)? – Borillar0821 Jun 30 '21 at 15:51
  • No, I just typed C:\Python27\ArcGIS10.6\Scripts at the command line prompt then pip2.7 install networkx and it installed it. I can then import it in the python console in Arcmap. – Hornbydd Jun 30 '21 at 16:25
  • Thanks! I'll try doing it this way. – Borillar0821 Jun 30 '21 at 16:29
  • I have tried doing this with NetworkX. Am I right, however, that NetworkX can only return routes made from straight segments (from node to node in the road network), not following curves in the road? – Borillar0821 Sep 21 '21 at 14:05
  • I've not used networkx in anger but I think looking at their help file when you load a shapefile only the logical connectivity of the network is stored. So the wiggly lines are simplified to straight lines. To reconstruct the wiggles of the shortest route you would typically read the edges of the solved route and get their ID's which should be the ID's of the original polylines, you could then construct the route as it would appear on the map instead of the mathematical graph. I'm sure some searching on the internet will throw up examples? – Hornbydd Sep 21 '21 at 16:10
  • This Q&A hints at how to return the underlying geometry. – Hornbydd Sep 21 '21 at 16:19

2 Answers2

0

You can use geometric network and Utility Network tools for this task. First picture shows original network:

enter image description here

Second shows results of Find Path Upstream task:

enter image description here

As one can see it successfully locates all nearest sources.

To get counts simply specify type of results returned:

enter image description here

Network shown is a tiny fraction of collecting network -streams reaches (2M total!), flow direction -WITH_DIGITIZED_DIRECTION. I don't see a reason why it will not work with distribution network.

Note: all tasks are automatable using tools from Geometric Network toolset.

My personal preference is networkx module, but it getting slow with graphs that have over 50K edges.

FelixIP
  • 22,922
  • 3
  • 29
  • 61
  • Thanks! Unfortunately, I don't have the license for the Geometric Network toolset, either. But I will look into the networkx module. The networks I work with are big, but they seldom have 50K edges. – Borillar0821 Jun 29 '21 at 17:55
0

I've tried the Networkx module in Python. From what I can see, though, it only draws a path from node to node on a graph, not following the curves in the edges. Thus, if finding a distance along a road network is what's needed, Networkx returns only an approximation of it. I'm yet to find out whether this is good enough for my purposes. In case it isn't, someone has elsewhere recommended the QNEAT3 plug-in for QGIS. Can anyone else suggest other alternatives to the Closest Facility solver that return a more exact route?

Borillar0821
  • 91
  • 1
  • 7