0

I'm looking for a solution to create optimized fixed-width corridors as line features restricted by a barrier raster.

The corridors should be independent from each other, meaning intersections are allowed and no network is necessary - so the corridor A-B does not have to have a connection to the corridor C-D. There should be corridors from all sources to all destinations, meaning A-B, A-C, A-D, ... B-A, B-C, B-D, etc. Sources = destinations, so they depict the same dataset. In ArcGIS Pro I've already tried several tools:

  • Distance accumulation + Corridor -> Cannot set a fixed-width corridor, output is not a feature but a raster
  • Distance accumulation + Optimal Path as Line -> No corridor to be set
  • Optimal Region Connections -> No corridor and network-dependent (by far not covering all possible connections)
  • Optimal Corridor Connections -> Network-dependent (by far not covering all possible connections)
  • Network tools / dataset -> Network-dependent, path optimization for network creation not available

As a last option I'm thinking of building a small python script for-looping through the Distance accumulation + Optimal Path as Line combination to at least create all optimized paths. Since there can be a lot and computation might become intensive (1700 sources/destinations), the mandatory corridor constraint and at best a max distance constraint (below a specific distance) for the optimization might come in very handy, also for further processing of the data.

3
  • 1
    Few details are missing. How big is your raster, cells count? Are source, destinations points or polygons? Do you really have 2 cost rasters for corridor, or just one? Also note A-B is just a reverse line to B-A in absence if vertical horizontal factors
    – FelixIP
    Commented May 9 at 19:19
  • It's 11012x9531 in size, sources and destinations are points; for corridor the least cost corridor tool is meant - yes, two cost rasters are used here, the one for the source and the one for the destination as the documentation suggests; yes, A-B equals B-A, no vertical or horizontal factors to be considered.
    – Seb
    Commented May 14 at 8:59
  • Addition: yes, two accumulative cost rasters and back direction rasters are used here, each one for the source and the destination as the documentation suggests
    – Seb
    Commented May 14 at 9:06

1 Answer 1

0

The script below assumes that you have these layers in maps table of content:

enter image description here

First two are just clones of your points feature class and their table looks like that:

enter image description here

Script will save N-1 sets of least cost paths as polylines in workspace database:

enter image description here

You'll need field READY to restart code after ArcGIS fails at some iteration.

Script:

from arcpy.sa import *
'get relevant layers from current map'
mxd = arcpy.mapping.MapDocument("CURRENT")
DESTINATION,SOURCES = [arcpy.mapping.ListLayers(mxd,item)[0] for item in "DESTINATION","SOURCES"]
d = arcpy.Describe(SOURCES)
OID = d.OIDFieldName
fids = [row[0] for row in arcpy.da.TableToNumPyArray(SOURCES.dataSource,OID,"READY=0")]
COST = Raster("COST")
with arcpy.da.UpdateCursor(SOURCES.dataSource,"READY","READY=0") as cursor:
    for row in cursor:
        dest = fids.pop(0)
        arcpy.AddMessage("Processing %i" %dest)
        DESTINATION.definitionQuery = "%s = %i" %(OID,dest)
        SOURCES.definitionQuery = "%s > %i" %(OID,dest)
        BLINK = CostBackLink(DESTINATION,COST)
        cDist = CostDistance(DESTINATION,COST)
        outfc = "To_%s" %str(dest).zfill(5)
        CostPathAsPolyline(SOURCES, cDist, BLINK, outfc,"EACH_CELL",OID)
        row[0]=1
        cursor.updateRow(row)
        if len(fids)==1:break
DESTINATION.definitionQuery = ""
SOURCES.definitionQuery = ""

Couple of outputs:

enter image description here

enter image description here

1
  • Solves the stated problem. Is it possible to add a fixed line width as constraint for the paths optimization?
    – Seb
    Commented May 15 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.