The second (sc.) only has data when the first is equal to 1. The first (narr.) has values ranging from 1 to 10. I have 2 rasters, narrgridClip and scneg15. But at the last step, where I am using raster calculator in model builder, getting an error. I have converted it to python script to make a batch script. CheckOutExtension ( "Spatial" ) # Execute Minus outMinus = Minus ( inRaster1, inRaster2 ) # Save the output outMinus. 1 05-02-2014 07:18 AM by AndrewMontreuil New Contributor I am getting an error running raster calculator that I can't figure out. 11 12-17-2019 10:59 PM by MudassarAli2 New Contributor Dear All I have a model builder in ARCMap desktop 10.5 which is executing fine. workspace = "C:/sapyexamples/data" # Set local variables inRaster1 = "degs" inRaster2 = "negs" # Check out the ArcGIS Spatial Analyst extension license arcpy. Note that instead elif I used if as every your branch returns a value (so the next statements are skipped).# Name: Minus_Ex_02.py # Description: Subtracts the value of the second input raster from the # value of the first input raster on a cell-by-cell basis # Requirements: Spatial Analyst Extension # Import system modules import arcpy from arcpy import env from arcpy.sa import * # Set environment settings env. If (aClass = 'secondary' or aClass = 'tertiary' or aClass = 'trunk' or aClass = 'motorway' or aClass = 'primary'):Įlif (aClass = 'secondary_link' or aClass = 'tertiary_link' or aClass = 'trunk_link' or aClass = 'motorway_link' or aClass = 'primary_link'):Įlif (aClass = 'service' or aClass = 'track_grade1' or aClass = 'track_grade2' or aClass = 'track_grade3' or aClass = 'track_grade4' or aClass = 'track_grade5'):īut in Python is more elegant this: def speed(aClass):įclass = 'tertiary_link' # Only for testing You probably wanted this: def speed(aClass): In the 'Environment Settings' window, click OK. Navigate to a directory location without spaces in the pathway, and then click Add. Next to 'Scratch Workspace', click the Open Folder icon. I don't see why this is necessary in this script but I put in some extent and cell size statements anyway. I simply did not select the "Python" radio button. Similar to other geoprocessing tools available in ArcGIS Desktop, REPTool can be run from a dialog window, from the ArcMap command line, or from a Python script. From the Tools menu, select Geoprocessing/Environments. 05-11-2012 07:22 AM by GerryGabrisch Occasional Contributor III My Python code throws an error at the first raster calculator statement claiming that no cell size or extent are set. There are no plans to release an ArcGIS Desktop 10.9, and it is recommended that you migrate to ArcGIS Pro. The outputs don't make any sense to me, and. For specific Python issues, consult the external Python help for the version of Python youre using, or consult the Calculate Field or Calculate Value help for more information on these tools. Tools Tool reference Spatial Analyst toolbox Map Algebra toolset Raster Calculator ArcMap 10.8 Other versions Help archive ArcGIS 10.8.2 is the current release of ArcGIS Desktop and will enter Mature Support in March 2024. I am receiving the error from running a shorter and simpler code: def Speed(road): I am trying to use raster calculator (ArcMap 10.) to apply a poisson generalized linear model to estimate species abundances based on elevation. Issues addressed at ArcGIS Pro 3.0.4 ArcGIS Pro 3.0. If (class = ‘secondary’ or class = ‘tertiary’ or class = ‘trunk’ or class = ‘motorway’ or class = ‘primary’):Įlif (class = ‘secondary_link’ or class = ‘tertiary_link’ or class = ‘trunk_link’ or class = ‘motorway_link’ or class = ‘primary_link’):Įlif (class = ‘service’ or class = ‘track_grade1’ or class = ‘track_grade2’ or class = ‘track_grade3’ or class = ‘track_grade4’ or class = ‘track_grade5’):Ĭan anyone spot what I'm doing wrong to receive a syntax error? I open the field calculator for the SpeedLimit field and fill the following: I feel like I'm blind.ġ) I create a new short integer field called "SpeedLimit" in my ArcGIS attribute table that signifies the speed limit for a road type.Ģ) The road type is a string found in the field "fclass" in the same table. I've been unable to get a simple block of code and am hoping someone can spot what is wrong.
0 Comments
Leave a Reply. |