0

I'm writing a Python script tool for ArcGIS Pro and among other things, I need it to compare coordinate values (lat & lon) in a GDB table to a polygon feature class and determine which polygon each pair of coordinates intersects with and populate another column in the table with the polygon ID.

Is this possible without creating a point layer from the coordinates? Is there any tool that can do something similar to Identity but with a table of coordinates as the in_features? Or SelectLayerByLocation using a coordinate pair to select the polygon?

I don't want to convert the table of points to a point feature class because I want to edit the table itself, and the table of coordinates is just a subset of a larger table in which not all rows have coordinates.

If this helps, my table has a column called "Quad", and most rows have a value in this column. But when that value is missing, I want to use the lat/lon coordinates (if there are any listed) to determine which Quad the row belongs in. I have a polygon feature class in the same GDB that defines the Quads (non-overlapping polygons).

1

1 Answer 1

1

Is this possible without creating a point layer from the coordinates?

I know you said you don't want to create a layer, but I'm assuming you actually meant you don't to create a featureclass as you say just that in the next paragraph. A layer is an in-memory representation of the data, not the data itself. You can create a point layer from the x,y coordinates stored in the table. The point layer only exists in memory, nothing is written to the filesystem and the layers datasource is the original table, not a point new featureclass.

You can use Make XY Event Layer tool to make the point layer and then use that to do a spatial join, identity or select layer by location overlay operation.

Make XY Event Layer (Data Management)

Summary

Creates a point feature layer based on x- and y-coordinates defined in a table. If the source table contains z-coordinates (elevation values), that field can also be specified in the creation of the event layer. The layer created by this tool is temporary.

2
  • Thank you for the suggestion - and yes, I was trying to avoid creating output that was written to the drive (not in-memory). I didn't realize Make XY Event Layer could create output in-memory. I've only used it on tables in my map (ArcMap & ArcGIS Pro). But that makes sense. I could do that, but doesn't spatial join write output (not in-memory) - as well as identity? I could use select, but then I would probably need to iterate through every point individually, right?
    – jencarta
    Oct 13, 2023 at 13:21
  • For the short term, I ended up adding a field to my table that I could later use to join back to the points I create from the lat/lon fields. Then, I created a point feature class using XY Table to Point, used Identity with the Quad polygons to get another feature class that I could join back to my original table using the join field I created. I then calculated the Quad field, removed the join, and deleted the two temporary feature classes (the XY points & the Identity output) and the join field. This works fine but is kind of clunky.
    – jencarta
    Oct 13, 2023 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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