Select to view content in your preferred language

Select a feature by XY coordinates

1456
5
08-20-2012 11:36 AM
Gi-ChoulAhn
Deactivated User
I have three point features and a line feature. Each points of the point features are connected by the line feature (network). I am working on transfering attributes from the point features to the line feature. I previously have done that using Arcpy and Xtools. However, due to the processing time efficiency, I prefer to do that using Arcpy only. This will be possible if I can select a point feature based on the XY coordinate of an end point of selected network line. Is it possible to select a point feature by XY coordinate?

Thanks,
Gi-Choul
Tags (2)
0 Kudos
5 Replies
KenCarrier
Deactivated User
If this is a network I would look into the Infrastructure Network Editing Template as there are already prebuilt functions within the Dynamic Value table to do this for you. Although if you are looking for a python method I would recommend using SelectLayerByAttribute

Using this method you could pass a query to this tool assuming you have X and Y coordinate fields in your attribute table.
0 Kudos
Gi-ChoulAhn
Deactivated User
Thank you, Ken, for your reply. I don't populate X Y coordinate fields in the attribute table. The point features are stored in file geodatabase and are pretty big. I don't modify attribute tables of the point features during my program run. But I see your point.
Does that mean that selecting a feature by XY coordinates is not possible in Python besides attribute selection?

Thanks,
Gi-Choul
0 Kudos
KenCarrier
Deactivated User
The only other thing I can think of is this;

1. Add XY Coordinates tool to an in memory object
2. Perform a SelectLayerByAttribute

Once you have your selection do your processing
0 Kudos
Gi-ChoulAhn
Deactivated User
That's interesting, Ken. I would like to see an example of setting up "in memory with X,Y coordinate points". Could you share one?

Thanks,
Gi-Choul
0 Kudos
Gi-ChoulAhn
Deactivated User
I solved my problem using pretty basic approach. For a selected line, I (1) retrieved XY coordinates of start and end of the line, (2) used SelectLayerByLocation to find any point features intersected by the line, (3) extracted XY coordinates of the intersected points, and (4) finally compared the start and end XY coordinates of the line with XY coordinates from point features. Once FROM point and TO point were identified, attribute transfer was just a matter of reading attribute from point and writing to the line attribute. This process was looped through the whole line segments.

Cheers,
Gi-Choul
0 Kudos