TransWikia.com

Euclidean distance raster fails with ArcPy script

Geographic Information Systems Asked on November 26, 2020

I am working on a script tool to create watersheds.
Part of my process requires a distance raster from various features that I use in an equation to perform local modifications to my DEM.

I have been unable to get arcpy.sa.EucDistance() to do anything when working with the in_memory workspace.

If I set the output to an FGDB it appears to work.

What am I missing to get this to work in_memory?

# convert vector points to raster points
# this output is successful
# I can do arcpy.CopyRaster_management(pp_ras, out_FGDB) and see 
# that in_memorypp__ras looks like i expect.

arcpy.FeatureToRaster_conversion(pourpoints, "OBJECTID",r"in_memorypp__ras", dem) 
pp_ras = r"in_memorypp__ras"  



# when I get to this part running in IDLE, the script just terminates with no
# pessages. If I print results from every step, the last one printed is me 
# setting teh pp_ras variable
# when I run from the script tool i'm building this into, the progressor gets 
# to "saving raster" and just  sits forever and I have to kill ArcMap/Catalog

euc_dist_in = arcpy.sa.EucDistance(r"in_memorypp__ras", "", "", "", "")
euc_dist_in.save (r"in_memorydist")
euc_dist = r"in_memorydist"

One Answer

Set the default workspace setting to in_memory. Something like this.

arcpy.env.workspace = r"in_memory"

Then change the names of your outputs to from "in_memoryfoo" to "foo"

See this example.

Answered by GBG on November 26, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP