Emil Brundage
  • Member for 7 years, 5 months
  • Last seen this week
Python script tool to make intersection points not working?
Accepted answer
0 votes

Your issue is with the arcpy function BearingDistanceToLine_management. The field types for certain input fields are not valid. According to the help these fields need to be numeric fields: x_field ...

View answer
Python Group by attribute range
Accepted answer
0 votes

It looks like you're passing your group field into your function instead of ObjectID. Be sure to pass in the ObjectID. Then make use of an Update Cursor to update your Group_ field. fc = r"path\to\...

View answer
Using arcpy.da.UpdateCursor to updateRow gives RuntimeError: row contains bad value?
0 votes

If you make use of a dictionary you can get your desired results with a single cursor. di = {} with arcpy.da.UpdateCursor("MyFishnet_wZones.shp", ["Zone_ID", "Fishnet_ID"]) as curs: for zone, ...

View answer
Intersecting polygons from different layers based on common values using ArcPy?
Accepted answer
1 votes

Here would be my workflow: Merge your two polygons together into a single feature class. Dissolve the merged feature class by field CODE. multi_part should be set to SINGLE_PART.

View answer
Comparing field values of two feature classes using ArcPy?
2 votes

As @PolyGeo mentioned, a search cursor proceeded by an insert cursor will do the trick here. First nab all the values from fc3 with a little python list comprehension and search cursor. Then iterate ...

View answer
Using the results of geoprocess function in another geoprocess function
Accepted answer
2 votes

All arcpy geoprocessing tools return a Result object. Result objects cannot be used as inputs into other geoprocessing tools. You'll need the path to the tool output to populate your list. selectList ...

View answer
Delete ONLY selected features in ArcMap / ArcPy
2 votes

Use the layer property FIDSet. It returns a string of selected features' OIDs. If no features are selected it returns an empty string. if arcpy.Describe ("layer").FIDSet: arcpy....

View answer
Invalid expression with string/text
2 votes

You're using double quotes for your select value when you should be using single quotes. Here's a few ways: arcpy.SelectLayerByAttribute_management('Subregional Groups', 'NEW_SELECTION', '"NAME" = \'...

View answer
Difficulty using variables as input parameters for arcpy.Intersect_analysis
Accepted answer
3 votes

I'd suggest assigning your paths to variables and then using those variables in each instance instead of the results of your geoprocessing. I'd also suggest inserting an r, indicating raw string, ...

View answer
Use ArcPy/Python to print out the number of selected features based on different selection criteria
8 votes

Get Count. Returns a Result object, whose first output is the count. Thus to get your count: count = arcpy.GetCount_management ('ParcelBoundaries_DevTest').getOutput (0) For whatever reason the ...

View answer
How edit a table for get a new one in ArcGIS?
Accepted answer
2 votes

You'll want to use the Pivot Table tool. Your input field will be FID_malla. Your pivot field will be GROUP, and your value field will be SHAPE_Area.

View answer
Spatial Join a List of Feature Class Files from Seperate Directories
1 votes

20180201.shp is a data set from the folder r"C:\Folder1". After finding this shapefile you change the workspace to r"C:\Folder2". Thus when you reference the variable inFeature1 in your spatial join ...

View answer
Error 000732 - Input Layer "does not exist or is not supported" when using 'ApplySymbologyFromLayer_management'
0 votes

You have too many backslashes in your path to your layer file. r means raw string, so no need for \\ when you use r in_symbology_layer = r"Q:\GW\EC1210WQAEH_QESEA\CSSP_ATL\Data\lyrfiles\...

View answer
fromWKT - how to pull all info from source data?
1 votes

Since you're going from a table to a shapefile you'll have to create a new shapefile and add each field individually. Then initiate an insert cursor for your new shapefile and a search cursor on your ...

View answer
Populate missing fields/labels for a grid of polygons with python?
Accepted answer
1 votes

I don't know a thing about Pandas, but I'd approach labeling these grids from a different direction. The direction I'd go is iterating through polygons with labels, selecting of neighbor polygons, and ...

View answer
Deleting selected rows in ArcPy?
1 votes

applying an SQL query to your cursor as described by @AlecZ is a good option. If you prefer a slower but easier-to-read option you can put all your keep values in a list. Iterate through your rows and ...

View answer
Strange "inFeatures" value for Intersect tool
2 votes

inFeatures.extend (fc) adds a string to the list outFeatures. fc is a string, and .extend iterates the string and adds each character to the list unionFile. unionFile itself is a list of a list, since ...

View answer
WKT to shapefile using arcpy
Accepted answer
2 votes

Use the 'SHAPE@WKT' instead of 'SHAPE@'. SHAPE@ requires a geometry object as an input. def create_shapefile(self, input_file, data, template): try: arcpy.CreateFeatureclass_management(os....

View answer
arcpy.Delete_management not working?
Accepted answer
2 votes

You have a typo in this part of your code: if arcpy.Exists(r'F:\MyProject\Assignment\folkore_shp.shp'): arcpy.Delete_management(r'F:\MyProject\Assignment\folkore_shp.shp') folklore is misspelled. ...

View answer
Function to change parts of data source instead of replacing path?
Accepted answer
2 votes

String manipulation will achieve your goal: mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd") df = arcpy.mapping.ListDataFrames(mxd)[0] for lyr in arcpy.mapping.ListLayers(mxd, "", df): ...

View answer
Using SelectLayerByAttribute with list of values in ArcPy?
Accepted answer
3 votes

Iterate through your list of circuits and then create an SQL that matches the format you'd see in an ArcMap selection. For text fields in a file geodatabase: YOURFIELDNAME = 'FIELD VALUE' Your code ...

View answer
Using wildcard argument with ArcPy?
0 votes

Set the layer's workspace path directly instead of using findAndReplaceWorkspacePaths: for lyr in arcpy.mapping.ListLayers(mxd, "*", df): if lyr.isFeatureLayer: lyr.workspacePath = r"P:\...

View answer
Create a multiple ring buffer according to field value + fixed set of values (ArcPy, Python)
Accepted answer
3 votes

As @Hornbydd mentions in comments, merging all feature class will do it for you. import arcpy arcpy.env.workspace = "C:/data/Py.gdb" fc = "lines" distances = [10,20,30] #empty list for feature ...

View answer
Creating list of feature layers, running select by location, and returning results in ArcPy?
Accepted answer
2 votes

Your layers aren't being stored in the designated workspace. They aren't being stored in any workspace in fact, given the nature of layers. You're thinking of Save To Layer File, which is different ...

View answer
Delete records in feature class that have same ID in CSV table using arcpy cursors
Accepted answer
3 votes

Store all of your csv IDs in a python list. Then iterate and delete with an update cursor if the leak number is in the list: import arcpy tc = "d:\\temp\\tc.shp" changes = "d:\\temp\\changes.csv" #...

View answer
Filed calculator python code for auto increment not working
0 votes

It sounds like an issue with ArcGIS not reading the attribute table in the order of the OID field, which I've heard of happening before. My first suggestion is to copy/paste the feature class, delete ...

View answer
Preserve Nulls Environment Setting with Append in Arcpy - warning 000596
1 votes

I believe that the help is referring to the field mapping property Allow NULL values. You can access this property by right-clicking on a field in the field mappings window and clicking on Properties.....

View answer
Changing different multi values based on the FID field using ArcPy?
Accepted answer
3 votes

Make use of the OID@ token available with data access cursors. It can be used in place of the FID field name for the feature class. import arcpy lyrName = r"G:\desktop\Project\lyr\point1.shp" with ...

View answer
Identifying contiguous polygons using ArcGIS Desktop?
Accepted answer
1 votes

The dissolve method is the best method. Due to the space between, you'll first need to buffer your polygons, then multipart-to-singlepart, then apply a unique ID to each buffer, spatially join that ID ...

View answer
Writing ArcPy Update Cursor "Where Clause" that Refers to its own Rows?
5 votes

Store the relationship between IDs and lat/lons in a python dictionary, generated with a search cursor. Then update your shapefile with an update cursor, reading lat and lons from your dictionary. No ...

View answer
1
3 4
5
6 7
14