1

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

1 Answer 1

3

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.

3
  • 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
    Commented Feb 17, 2017 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
    Commented Feb 17, 2017 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
    Commented Feb 17, 2017 at 22:56

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