Emil Brundage
  • Member for 7 years, 5 months
  • Last seen this week
Appending features in file geodatabase using ArcPy
Accepted answer
4 votes

Assuming all fields in all feature classes are the same, I suspect a data access insert cursor will be faster than the append tool. List your fields and then use a search/insert cursor combo. flds = [...

View answer
Merge Two layers Keeping only common fields
3 votes

Creating layers with hidden fields is the way to go here, using field info objects. I have a function I regularly use for this. Then it's a matter of creating your two layers and using them as inputs ...

View answer
Calculating sum per id using UpdateCursor of ArcPy
1 votes

It sounds like you want to sum all values by basin ID. Use a dictionary. Use the basin ID as your key. Add values to your dictionary in an initial iteration of your table. Then iterate your table ...

View answer
Saving outputs from arcpy.da.Walk to the same folder
Accepted answer
1 votes

All of the Mosaics are saved to the same output folder. Instead of using dirpath when creating your new raster use the same path each time. outPath = r"C:\some\path" for dirpath, dirnames, ...

View answer
Updating Cursor to Include Newly Created Features?
1 votes

I'd find your first geometry with a search cursor. Then iterate how many times desired, create new geometries based on the last iteration, and store those geometries in a list. Finally, use an ...

View answer
Update Cursor running for 4 hours
Accepted answer
2 votes

This code can get you stuck in an infinite loop if your gridecode value is never <= i. while i <= m: if row.getValue("gridcode") <= i: You're also updating your rows repeatedly, ...

View answer
Finding average distance from polygon to multiple points
Accepted answer
2 votes

You can use Summary Statistics for this. Use INPUT_FID as your case field and DISTANCE as your statistics field. Use MEAN for your statistic type.

View answer
Write Zonal Statistics as table to an editable table in Python
1 votes

I'd make use of the in_memory workspace to store your table. ArcGIS provides an in-memory workspace where output feature classes and tables can be written. Writing geoprocessing output to the ...

View answer
Select Issues with Converting Feature Class to Shapefile with only certain fields
Accepted answer
1 votes

Instead of copying and deleting, I like to create a feature layer and hide fields, then export. I've created a function for this task. Subtypes don't affect this method. def CreateFieldInfoLayer (fc, ...

View answer
Change nameString using arcpy?
Accepted answer
2 votes

Create a layer object from your file path. You can update and save the layer file using layer object properties and methods. >>> lyrFl = r"C:\test.lyr" >>> arcpy.Describe (lyrFl)....

View answer
CopyFeatures management creates long name
Accepted answer
6 votes

Turn off Qualified Field Names before joining. arcpy.env.qualifiedFieldNames = False Tools that honor the Qualified Field Names environment use this setting to distinguish between qualified or ...

View answer
Compare list of field names located in two separate dictionaries with same key
1 votes

Iterate through your first dictionary and pull out the key and the list of fields. Pull out your second list of fields using the same key. create an uppercase list of your second fields. Iterate ...

View answer
Getting RuntimeError while creating CreateGISServerConnectionFile using Python
Accepted answer
0 votes

You're not using raw strings for your path strings. This can cause issues due to backslashes. Put an r in front of your strings. r'\\gis\users\Locators'

View answer
Python Toolbox Value Table values and list inputs
1 votes

These like makes x or X the only allowable value: param4.filters[0].list = ['x'] param4.filters[1].list = ['X'] Remove these lines.

View answer
Parameter dependencies based on two datasets in Python toolbox
Accepted answer
3 votes

As suggested by @mikewatt in the comments, you'll need to custominze this functionality with arcpy.ListFields. This will need to be done in the updateParameters function. Check for your parameters ...

View answer
Multi choice parameter data type in ArcMap Toolbox
1 votes

This answer is still the case. Radio buttons are not an option. Use Boolean for a check-box. This will allow for two choices (checked vs unchecked). Another option is to use String and add a filter ...

View answer
Python user defined function written for ArcGIS Pro returns None when it should return an address?
Accepted answer
1 votes

This chunk of code would produce an exception since your row index is out of range. with arcpy.da.SearchCursor(CoaAddresses, ['FULL_STREET_NAME'], where_clause=expression) as cursor: ...

View answer
Field mapping features to different feature with different field names using ArcPy
Accepted answer
2 votes

I assume you mean the geometries aren't added with your first code. Add the SHAPE@ token for data access cursors to your list of fields. It will insert your geometries. outfcfield = ['SHAPE@', '...

View answer
Counting and listing all shapefiles that falls inside layer polygon with ArcPy
1 votes

I would iterate through your layers and perform a select by location, selecting for points intersecting your polygons. If all your points are selected the layer is completely contained in your ...

View answer
Counting points between two intersections: Roadway Network
3 votes

Your main goal is to create a single feature between intersections. Here's how to create single feature road features: Perform an intersect on your road segments with output type set to POINT. Add ...

View answer
ArcPy Select Layer by Attribute for Date and Time
3 votes

You need date at the start of each date and single quotes for its value. You may also need to use 00:00:00 for midnight. Try selecting by attribute in ArcMap first and copying its format. "...

View answer
Run code on pressing a key in Pythonaddins
1 votes

Use MessageBox instead of print. def onKeyUp(self, keycode, shift): pythonaddins.MessageBox("Process Started", "Process") pythonaddins.MessageBox("Key pressed: " + keycode, "Key") ....

View answer
Add legend with ArcPy over my interpolated map
Accepted answer
3 votes

Create/save the map document with a legend. When you add your layer it will automatically be added to the legend as long as Add a new item to the legend when a new layer is added to the map is ...

View answer
Removing border that appears in map exported with arcpy.mapping.ExportToPDF?
Accepted answer
2 votes

In layout mode click on the data frame to select it. Then right-click, and choose Properties. Click the Frame tab and choose <None> for Border.

View answer
Do the same as File>>Export Map>>Save as PDF with a Python command in ArcGIS
Accepted answer
0 votes

Use ExportToPDF. From the help: import arcpy mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd") arcpy.mapping.ExportToPDF(mxd, r"C:\Project\Output\Project.pdf")

View answer
Field not updating correctly by updatecursor() method
Accepted answer
2 votes

Create a set and populate it with values using a cursor. If you find a value that's already in the set update your table. ids = set () with arcpy.da.UpdateCursor(layer.name, "ID") as outs: for ...

View answer
Iterating through geodatabase and assigning field value based on spatial location using ArcPy
Accepted answer
2 votes

I suspect "InstallationID" isn't a field in your table. Double check the field name. >>> curs = arcpy.SearchCursor ("Meters_RandomSel_geocoded") >>> row = curs.next () >>> ...

View answer
Listing attributes of arcpy.Describe object in python?
4 votes

You probably just have to brute force it and create a list of all possible describe object properties. inOb = r"C:\Your\Input" desc = arcpy.Describe (inOb) properties = ['DSID', 'FIDSet', '...

View answer
Combining ListDatasets and ListFields to return geodatabase contents to CSV--one script prints attributes and another returns feature class counts
Accepted answer
0 votes

In your first script fc is your feature class. After for fc in arcpy.ListFeatureClasses('*','',fds): add your ListFields script. import arcpy arcpy.env.workspace = "C:\Users\Redfish\Test.sde\Test....

View answer
Checking feature overlap using ArcPy cursors
Accepted answer
3 votes

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 = ...

View answer
1
2 3 4 5
14