Emil Brundage
  • Member for 7 years, 6 months
  • Last seen this week
Getting "ERROR 000999: Failed to get raster"?
Accepted answer
3 votes

You've got a file geodatabase as your workspace, which can't house tifs. Set your workspace to the folder containing the tifs or remove the .tif if the rasters are in your geodatabase.

View answer
Trying to use layer saved as .lyr file with arcpy.mapping.Layer function results in error?
Accepted answer
3 votes

There is an issue with this line: arcpy.SaveToLayerFile_management(temp_CSlyr, temp_CSlyr, "ABSOLUTE") Since no directory is specified the layer file is created in some unknown location - from all ...

View answer
Add and Calculate Fields of Iterated Annotation Classes
Accepted answer
2 votes

As BERA mentioned in comments, you need to specify PYTHON as your expression type. The default is VB. arcpy.CalculateField_management(fc, "KM_FontSize", "!FontSize!", "PYTHON")

View answer
Searching locations in any ArcGIS Basemaps?
1 votes

In ArcMap go to Customize -> Toolbars -> Geocoding You can use the toolbar to navigate to addresses.

View answer
Reading CSV in loop stops at row that does not match?
Accepted answer
2 votes

Add a try\except to skip the feature classes/tables that don't exist. for fcs in objectsinESRI: try: fieldList = arcpy.ListFields(fcs) except IOError: continue for field in fieldList: ...

View answer
Deleting row using ArcPy cursor?
Accepted answer
2 votes

You have the potential to try to delete the same row twice since you have a for occuring in each row. break out of your for loop if a deleteRow occurs. >>> for row in uc: ... for r in ...

View answer
ArcPy not reading Layer properly?
0 votes

arcpy.GetCount_management(Stationer)[0] returning 0 can mean one of two things: The layer's feature class contains no features. A selection was applied to the layer that returned no selected ...

View answer
Interactively selecting polygon in ArcMap and passing selected feature to ArcPy?
1 votes

Working in the ArcMap environment you simply need to pass a string of the layer name into your copy code. Thus if the selection is manually done instead of with your SelectLayerByAttribute_management ...

View answer
Problem with if-statement and whereClause format
Accepted answer
3 votes

As @blabbath has mentioned this line of code isn't doing what you'd like it to do: if arcpy.Describe(fc_clipped).shapeType == "Point" or "Polygon": This statement will always return True regardless ...

View answer
Copying shapefile to Feature Dataset using ArcPy?
2 votes

You are mixing a variable with a string object. dataset1 = "C:/SDE.gdb/temp1" #dataset1 is a variable arcpy.CopyFeatures_management("scrap.shp", "dataset1") #dataset1 is a string because of the ...

View answer
Check 2 Extents with Disjoint in Arcpy - Wrong Result
Accepted answer
1 votes

Extents need to be in the same projection for disjoint to work. Here I have an mxd with two data frames. Each data frame has the same extent but two different projections. In this case disjoint ...

View answer
Using RemoveLayer in arcpy.mapping?
Accepted answer
2 votes

You're still referencing the layer file with your variable lyr. You'll need to find it in your mxd before you can remove it. Maybe something like this: lyrlist = arcpy.mapping.ListLayers(mxd) lyr = [...

View answer
Getting for loop which stops after first one to iterate properly?
1 votes

I suspect that you have a selection on your layer when your script is run. If this is the case only selected features will be run. A couple solutions - 1) Clear selection prior to determining your ...

View answer
Deleting blank fields in multiple shapefiles in folder using ArcPy?
Accepted answer
0 votes

Create a list of fields per feature class. Next iterate through each table and check each attribute for value. If an attribute has a value add the field to a list of keep field. Any field that doesn't ...

View answer
Selection by attribute from list
Accepted answer
2 votes

This line is selecting for all values {} in field Name2. arcpy.SelectLayerByAttribute_management("selectlayer", "NEW_SELECTION", "Name2 =' {} '") Try this: arcpy.SelectLayerByAttribute_management("...

View answer
Comparing value with value from the next row
2 votes

Iterate your table and assign your value and the oid to variables. Create a set of OIDs with values equal to the next value by comparing the last oid to the current. Iterate one more time and update ...

View answer
Refering to (Joined) Field Names in arcpy in Field Calculator
3 votes

Once a table is joined you need the name of the table where the field originated as well as the field name, separated by a period. Update ( !test2.Shape!, !test1.NEAR_X!, !test1.NEAR_Y!)

View answer
Python to generate a different number of random points for features using iteration with tool parameter values in feature attribute table
1 votes

arcpy.CreateRandomPoints_management has an input parameter number_of_points_or_field. Input the field name containing your point count for this parameter. Example: arcpy....

View answer
Assigning Name to Each Points
3 votes

It looks like points are stacking up due to duplicate line features or line feature segments. I'd perform a delete identical on your output point feature class, either before or after your cursor. ...

View answer
Conditional join or query of two layers
2 votes

Add your FLOODING field to your CONDUITS table. Perform a Table Join on your CONDUITS layer: Right-click on the CONDUITS layer in the table of contents -> Joins and Relates -> Join.... In box 1 use ...

View answer
ArcMap "Polyline to Raster" output is empty greyscale raster
Accepted answer
1 votes

The issue is with the Cellsize input. When I tested the tool the default was quite large. Reduce the Cellsize value to something that suits your data. Here I have lines that are several hundred feet ...

View answer
1000 features limit using CopyFeatures_management?
1 votes

As I describe in my blog, you'll need to created a function which selects 1000 values at a time. Here's what I came up with: import arcpy def LayerFromList (inLyr, inField, inList): """ ...

View answer
How to break a string line with many values to a single field?
0 votes

You can to get a bit fancy with try/excepts, logic tests, and string manipulations. with arcpy.da.UpdateCursor(feature, ["CPFS_CNPJS", "identifica"]) as cursor: for row in cursor: try: ...

View answer
Field mappings remove field from arcpyTable to Table conversion
1 votes

I'm not sure why removing the field doesn't remove it from your output. I've found the following to work: Creating a new field mappings object Iterate through your original field mappings object ...

View answer
Using cursor to delete rows with <Null> values in table using ArcPy?
0 votes

Use None. with arcpy.da.UpdateCursor(fc, 'Grid_Code') as cursor: for row in cursor: if row[0] == None: cursor.DeleteRow(row)

View answer
Using `arcpy.Exists()` and `arcpy.Delete_management` on a temporary layer
Accepted answer
2 votes

In your code select is a results object. >>> lyr = arcpy.MakeFeatureLayer_management ("roads", "layer") >>> type (lyr) <class 'arcpy.arcobjects.arcobjects.Result'> Use the ...

View answer
Exceptions in arcpy using specific errors?
0 votes

You're close. It's actually arcpy.ExecuteError. try: ... for table in tableList: ... with arcpy.da.SearchCursor(table, ["qname","tname","query"]) as cur: ... for row in cur: ...

View answer
Using script to list .lyr files with broken links?
1 votes

Use a describe object to identify a layer's feature class. Then use Exists to determine if the feature class exists. If it doesn't the link will be broken. import arcpy, os path = r"M_XXX" for root, ...

View answer
Cannot find results of MakeFeatureLayer, cannot use SelectFeatureByAttribute
Accepted answer
2 votes

A feature layer is not stored on disk, meaning it's not going to show up in your GDB. A feature layer is a data format that mimics a layer in ArcMap's table of contents in many regards. For your code ...

View answer
Clip_analysis with several in_features and several clip_features
1 votes

If all your clip feature classes are the same geometry type (point, polyline, polygon) you can merge all of them into a single feature class before your clip: import arcpy import os arcpy.env....

View answer
1 2 3
4
5
14