Hot answers tagged

3

One potential issue: Your two geometries must be in the same spatial reference, so check this. More importantly: You want to use geometry.overlaps instead of geometry.touches. list_tif = [] sr = arcpy.Describe (boundary).spatialReference with arcpy.da.SearchCursor(boundary, ['SHAPE@']) as search: for r in search: for tif in tiffs: ...


3

Currently, the loop should be creating a row value of a list containing the number 0, which would probably error out. I think the deletion of row and cursor are also unnecessary as you have a with statement which should close out of the cursor properly. If you want just the first item of a string value from the first element in the row, calculate it as ...


3

1. Make it Case Insensitive Change your dictionary to use all lower-case keys. (eg, 'dr': 'Drive' ). Then change your assignment statement to use the lowercase version of the value as the key to your dictionary: row[0] = d[row[0].lower()].title() (I would leave out the title() myself, and just make sure that the dictionary values are all correctly title-...


2

" " is a string with a single space. None indicates a null value. You have a couple options: if not row[3]: ##returns true if row[3] is "", None, 0, []... cursor.deleteRow() or: if row[3] == None: cursor.deleteRow()


2

In my experience, you MUST include the [OID] or [FID] or [OBJECTID] or whatever your table-type considers to be a {row_id} in your field list when using Insert Cursors (and Update Cursors). If this is contrary to any documentation you have read I apologize! You may be asking " ... but why, the system generates the row_id automatically?" True, but the ...


1

In ArcGIS a feature_class name MUST be unique within a GDB. ie: if Dataset_AA contains Feature_Class_AA then Feature_Class_AA cannot exist anywhere else in the same GDB regardless of whether it is in a Dataset or not. take this schema for example: in this map: and this script: import arcpy arcpy.env.overwriteOutput = True feature_class = r'C:\P2P\...


1

Try this in a Label Expression for your grid (after removing comments) ... you will have to check 'Advanced' and make sure the Parser is set to Python. The expression will render the PageName as provided by the Grid Index Tool as well as a Second Line with the preferred Excel-style 'ABC....ZZ' columns and '123...' rows import numpy def FindLabel ( [PageName]...


1

There is a pivot table tool in ArcMap like there is in Excel. Maybe that would do it?


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