3

Try moving line 7 rasy=arcpy.sa.Raster(os.path.join(workspace2, trial)) into the if statement. It looks like this is being called on a non-existent .tif and will fail, causing the script to error out before reaching the if statement for this particular dataset. for inras in inras_list[5:]: rasx=arcpy.sa.Raster(inras) base=(os.path.basename(inras)....


3

I guess Michael Stimson is suggesting to do something like: for x in filestoo: if x.endswith('shp'): # Determine the new output feature class path and name outfc = os.path.join(outshape, x) # run project tool arcpy.Project_management(x, outfc, outCS)


2

Create a function to rotate points then use the da.UpdateCursor to update the geometry for each polygon. Code below will modify your data so backup before you try it: import arcpy, math fc = 'aPoly' #Change to match your data rotatefield = 'Rotation' #Clockwise rotation in degress. Change name to match your data #Function to rotate one input Point around ...


2

Try setting the arcpy environment property to true in the beginning of the script arcpy.env.overwriteOutput = True


2

This is somewhat guessing since your code snippet doesn't include some of the details, however: it looks like you may be trying to merge a dataset with a dataset that doesn't exist already. The first time you go through the loop, the table you've named "selecationmerge" doesn't exist; in fact it's assigned to an empty string. Additionally it's awkward (and, ...


2

Try this piece of code. I do not think that you have to cast the mean/std to float. Try it out this way. Of course you need an Spatial Analyst, but since you are using RasterCalculator I think you have it. import arcpy from arcpy.sa import * arcpy.CheckOutExtension('Spatial') ws2 = r"C:\unsupervised_classification\output\raster_tagliati_su_flowacc" ...


2

Your script is a bit inconsistent in how it refers to the fGDB. Sometimes by full path, sometimes just using the database name alone. To avoid this inconsistency, as well as to avoid errors due to typos, I usually assign the full path to a variable (eg, gdb). If you get a typo in your variable, its much easier to diagnose than a typo in a text string. ...


2

Try instead to put your list of buffered outputs into a list object. You might also set the workspace option before proceeded, otherwise ArcMap will send the output from the union to the default geodatabase. arcpy.env.workspace = "path to output folder or geodatabase" arcpy.Union_analysis([buffer1, buffer2, buffer3], buffered_area) Or if you know the path ...


2

GetParameterAsText gets the value AS TEXT. Therefore a,b,c,d are all strings. You need to convert them to a numeric format before asking Con to compare them to x.


2

Looks like it is having trouble finding the files. I use double backslash to get to my files. "C:\\ArcMap\\Res_Boulder.gdb\\Subject" See this reference which shows the valid and invalid path options https://pro.arcgis.com/en/pro-app/arcpy/get-started/setting-paths-to-data.htm


2

cvr_rasters will be a list of only raster names with no path/workspace. When you change workspace after it is created the rasters will not be found. Try adding path to each raster: ... arcpy.env.workspace = CVR cvr_rasters = arcpy.ListRasters() cvr_rasters = [os.path.join(CVR, r) for r in cvr_rasters] ... Same goes for lss_rasters since you change ...


1

I think to make your script work you should: remove all the arcpy.Raster() calls # Set names for optional output rasters, seems not working??? outDirectRad = arcpy.Raster(outNameDirect) outDiffuseRad = arcpy.Raster(outNameDiff) outDirectDur = arcpy.Raster(outNameDirDur) change the call to arcpy.sa.AreaSolarRadiation like this: # Execute ...


1

buffer1, 2 and 3 are result objects not the buffer outputs. Try: arcpy.Union_analysis([outpath, outPath1, outPath2], buffered_area, "ALL", "", "GAPS")


1

You may have the band name wrong, check them using arcpy.da.Describe, i.e. print([child['catalogPath'] for child in arcpy.da.Describe(outExtractByMask)['children']]) I get the band names as 'Band_1' to 'Band_<N>'. You could create a little function* to automatically pull out the band names, then your code would look something like: import arcpy, ...


1

You can use try/except to continue to the next set when error occured. for inras in inras_list[5:]: try: <your code> except: print ('error')


1

It has been a while since I post this question. The script has been updated since then and I post my answer in the following part for other users. list = [] rows = arcpy.SearchCursor(bufferclip) SumArea = bufferclip + "Area" for row in rows: area = row.getValue("Shape_Area") list.append(area) SumArea = sum(list) print SumArea arcpy....


1

Problem with my code was that I was using the 'CopyFeatures_management' function, which seems to expect a 'Feature Class' but I was trying to copy a static table. The code below copies static tables and is working for me. gp.CopyRows_management(r"C:\path\Irfan_Simple_Input_TBL.gdb\IrfanTable1", r"C:\path\OUTPUT\db_output.gdb\IrfanTable1")


1

When I run this code snippet (that I pulled from the code that you have presented) it appears that having a space in the pathname does not cause it to fail: import arcpy pointfc = r"C:\Temp space\TestProject\TestProject.gdb\pointfc" outputCSV = r"C:\Temp space\test.csv" arcpy.CopyRows_management(pointfc,outputCSV) When I run this code it works too (the ...


1

First of all you have set your workspace to an MXD called Ronan_Test. A workspace is a folder or geodatabase. So firstly I suggest you read the help file so you understand what and how to use the workspace environment correctly. The error is exactly what it is, you can't create an INFO table with the file paths you are using. Whoever allowed such path names ...


1

Your problem is identified in the 1st parameter of SaveToLayerFile as ERROR 000732, meaning the input layer (Layer_17011) "does not exist or is not supported". Not sure, but think the key is in that SaveToLayerFile expects a Layer data type - MakeFeatureLayer outputs a Feature Layer data type. According to the documentation, you can use getOutput(0) to ...


1

Your X-Maximum, Y-Maximum values are the same so you are not providing a valid rectangle. Recheck the bounding extent of your area and try again. http://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/clip.htm


1

Try the following adjustment to your code. Per the documentation for arcpy.mapping.layer, this line is looking for a layer instead of a feature class. You already tried to create a layer (arcpy.MakeFeatureLayer_management) first, but you are referencing the feature class again instead of the layer. import arcpy import os arcpy.env.workspace = r"C:\arcgis\...


1

Symbology applies to a layer, not to a feature class. From the help: This tool applies the symbology from a layer to the Input Layer. It can be applied to feature, raster, network analysis, TIN, and geostatistical layer files or layers in the ArcMap table of contents. You will need to make a feature layer within your code (the following is untested ...


Only top voted, non community-wiki answers of a minimum length are eligible