Is it possible to move MANY features to a specific lat-long based off a field (all features at once) within said features table, or by said features join?
Something like a replace geometry?
I appreciate your assistance!
Is it possible to move MANY features to a specific lat-long based off a field (all features at once) within said features table, or by said features join?
Something like a replace geometry?
I appreciate your assistance!
This is perfect! Thank you!
Could you assist me and elaborate on the following though?:
fc = "XY_Points"
["SHAPE@XY", "POINT_X", "POINT_Y"]
I'm curious is the fc the feature layer, what the "SHAPE@XY" is representative of, as well as if the "POINT_X" is the Longitude field and the "POINT_Y" is the Latitude field?
As well as what is being done?
with arcpy.da.UpdateCursor(fc, ["SHAPE@XY", "POINT_X", "POINT_Y"]) as cursor:
for row in cursor:
row[0] = (row[1], row[2])
cursor.updateRow(row)
My apologies for my lack of python knowledge.
I can't express my gratitude enough!
Best Regards,
Jerad White
I first import the arcpy module:
import arcpy
I then set my workspace to a File Geodatabase called Test.gdb.
from arcpy import env
env.workspace = r"D:\Temp\Python\Test.gdb
I could have also done this is one simple line:
arcpy.env.workspace = r"D:\Temp\Python\Test.gdb"
The from arcpy import env allows me to not have to write arcpy for any env functions. For example, I could write env.overwriteOutput = True if I wanted to set the option to overwrite outputs, instead of arcpy.env.overwriteOutput = True.
Since I set the env.workspace, I can simply reference any feature class/table by it's name rather than it's full path. I have a feature class called XY_Points, so I reference this using:
fc = "XY_Points"
After that I use an UpdateCursor to iterate through each row. ["SHAPE@XY", "POINT_X", "POINT_Y"] are fields I am referencing. You'll see if the UpdateCursor help link, SHAPE@XY is a way of accessing the geometry's XY coordinates.
I have two fields in the feature class called POINT_X and POINT_Y. POINT_X represents the longitude, and POINT_Y the latitude. I then reference these fields by the index in which I specified them, with the first index starting at 0, i.e. row[0], row[1], row[2].
Hi Jerad,
You could do this using python. Below is an example that updates the Shape field using the POINT_X and POINT_Y fields within the feature class.