Arc Hydro ArcGIS Pro - Longest Flow Path Snap Raster Error

1159
5
Jump to solution
01-23-2022 01:07 PM
Labels (1)
Jimmy_Simpson
New Contributor III

I receive the following error when running several of the longest flow path tools (for catchments, for sub-watersheds, etc.) in ArcGIS Pro.

('line 218', 'c:\\program files\\arcgis\\pro\\Resources\\ArcToolbox\\Scripts\\archydro\\longestflowpathforcatchments.py', "AttributeError: 'GPEnvironment' object has no attribute 'SnapRaster'")

Any help would be appreciated. Currently I am having to take my FCs and run longest flow path in ArcMap and then move back to Pro.

Tags (1)
0 Kudos
2 Solutions

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

open up the script and see how they set the snap raster

arcpy.env.snapRaster

is correct, it may be a capital S vs a small s issue in the script.  If it is, report it to the archydro people, I don't have it installed to check the script myself

Snap Raster (Environment setting)—ArcGIS Pro | Documentation

env—ArcGIS Pro | Documentation


... sort of retired...

View solution in original post

0 Kudos
Jimmy_Simpson
New Contributor III

Yes - Line 218 of the Longest Flow Path for Catchments is written as "SnapRaster" instead of "snapRaster" - Making this change allowed the script to run without error.

Arc Hydro team - please make this change on all Longest Flow Path scripts as I believe most if not all of them contain this error.

@DanPatterson - Thank you for solving this so quickly - its greatly appreciated!!! I also use your Numpy tools quite frequently so thank you for all you do!!!

View solution in original post

5 Replies
DanPatterson
MVP Esteemed Contributor

open up the script and see how they set the snap raster

arcpy.env.snapRaster

is correct, it may be a capital S vs a small s issue in the script.  If it is, report it to the archydro people, I don't have it installed to check the script myself

Snap Raster (Environment setting)—ArcGIS Pro | Documentation

env—ArcGIS Pro | Documentation


... sort of retired...
0 Kudos
Jimmy_Simpson
New Contributor III

Dan,

You hit the nail on the head I believe. I see 10 lines before that "snapRaster" and in line 218 "SnapRaster" - going to try making a copy of their script with that one change and see if it works.

I would report it to the ArcHydro team, but have sent them a couple emails reporting issues and have never got a response back. Since I see them replying to questions in this group, I am hoping this post does some good.

0 Kudos
Jimmy_Simpson
New Contributor III

Yes - Line 218 of the Longest Flow Path for Catchments is written as "SnapRaster" instead of "snapRaster" - Making this change allowed the script to run without error.

Arc Hydro team - please make this change on all Longest Flow Path scripts as I believe most if not all of them contain this error.

@DanPatterson - Thank you for solving this so quickly - its greatly appreciated!!! I also use your Numpy tools quite frequently so thank you for all you do!!!

ZichuanYe
Esri Contributor

Yes, it should be arcpy.env.snapRaster and not .SnapRaster.   We'll fix the issue and produce a new build.

Thanks for catching this error, and @DanPatterson for your quick reply.  

ZichuanYe
Esri Contributor

A new build with arcpy.env.snapRaster correctly set is posted at this location:

https://downloads.esri.com/archydro/archydro/Setup/Pro/2.9.13/

Please let us know if you have further questions