Select to view content in your preferred language

Allow updating geometry in Field Calculator

1500
6
07-27-2016 09:39 AM
Status: Closed
Labels (1)
GreggRoemhildt1
Deactivated User

Lets say I have two feature class,

 

- Points A. All the points have a unique point_id.

- Points B, these points have an ID that matches the point_id in the Points A class.

 

I can join these two tables using the point_id.

 

Now I would like to update the geometry of the points A feature class with the geometry with points B. This would be trivial in an SQL server...It would be very useful in ArcGIS file geodatabases.

 

    UPDATE Point_A a
    INNER JOIN Point_B
    ON a.point_id=b.point_id
    SET A.geom=B.geom;

 

Perhaps this could apply to any type of geometry also.

6 Comments
AnthonyClark3

This be done using Python. You can do an arcpy.da.UpdateCursor (point a) and store the point_id as a variable. Then nest an arcpy.da.SearchCursor on the second feature class (point b), with an if statement.

If point_id1 == point_id2:

    geometery1 = geometry2

Here's the link to UpdateCursor. And note, "Geometry properties can be accessed by specifying the token SHAPE@ in the list of fields."

UpdateCursor—Help | ArcGIS for Desktop

DrewFlater
Status changed to: Closed

The workflow described can be accomplished starting in Pro 3.1, but not using the Calculate Field tool. The Append tool has a new geometry update mode and parameters to configure how the update should be made. This was covered in this newer Idea: https://community.esri.com/t5/arcgis-pro-ideas/gp-tool-to-batch-replace-geometries-from-one-fc-to/id...

DrewFlater_0-1672770303061.png

 

Bud
by

Just to clarify:

This idea is called "Allow updating geometry in Field Calculator". But I wonder if that title is misleading. At first glance, that title makes it sound like it's not possible to update a FC's geometry using the Field Calculator. But we can update the geometry of FC using the field calculator:

Bud_0-1681071701006.png

That works as expected.


What we can't do is update a FC's geometry using the geometry from a different FC. At least not using the Field Calculator.

Reason: When we join to a different FC, the SHAPE column from that FC doesn't get brought in as a joined field. So, it's not a valid input.

But in Pro 3.1, it can be done using a different tool: the Append tool.

@DrewFlater Is that correct?

DrewFlater

@Bud your summary is correct. ArcGIS in general has a hard limitation that any table can only have one Shape column. I talked to a few developers and our system would destabilize if we lifted a limitation that two Shape columns could be in one table as a result of a join or other process. 

The Append/Upsert enhancement you explained is an easy solution for this problem, or you can write a few lines of Python code using a search and update cursor to read one feature geometry then write/calculate/update the geometry of another feature based on it. 

Bud
by

Ok. Thanks @DrewFlater.