I'm working with data that constantly changes, and would like to write a script to automate my tasks.

My tasks are as follows:

create 3 polygons->select earthquakes within those polygons->edit earthquakes attribute table to include a field that labels earthquakes by region.

Is there a way to edit attribute tables and use the editor functions with ArcPy? I would prefer to use ModelBuilder, but I don't believe this offers the ability to edit features/tables. I'm still new to ArcPy and will post solutions if I find any.

EDIT: I'm not asking for the code I just want to know if this workflow is possible

closed as off-topic by ahmadhanb, PolyGeo Feb 17 '17 at 9:45

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking help to debug/write/improve code must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Providing a clear problem statement and evidence of a code attempt will help others to help you. See: How to create a Minimal, Complete, and Verifiable example." – ahmadhanb, PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.


If you ask directly for arcpy you may hava a look at arcpy.da.UpdateCursor Update Cursor for Arcmap 10.3

You have some examples there for the calculation. And you may use arcpy.da.SearchCursor for your select task.

But you can easily inculde this in the model-builder. The tools you need are "Select Layer By Location" and "Calculate Field". Both are equal to the normal tools you use for "select by location" and the "field calculator" in the attribut table.

  • this helps, thank you! I didn't realize add field and calculate field were part of model builder- I'm still new to model builder and arcpy. I'll post my model and/or code once completed. – jrowley Feb 17 '17 at 19:24
  • @jrowley pretty much any GP tool can be used in MB. Just drag and drop from the toolbox into your MB window. – Paul Feb 17 '17 at 19:28
  • I should have guessed table functions would be in the toolbox as well, thanks for that. Is there a way to iterate the selection, and use those iterations to fill in each field? I did each polygon manually, but if I had dozens of features to choose from I would prefer to automate this – jrowley Feb 17 '17 at 22:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.