Get a FGDB FC point's XY coordinates using SQL

522
6
12-05-2022 06:58 PM
Status: Needs Clarification
Labels (1)
Bud
by
Notable Contributor

In an SQL Expression or a database view on a file geodatabase:

If I understand correctly, we can't access the XY coordinates of a point feature using SQL.

For example, something like this:

x_coord(shape) --would resolve to 665,478.140 meters


Could that functionality be added as a function in the FGDB engine/SQL syntax?

I'm aware that a workaround would be to store the X and Y coordinates in static fields in the FC via a calculation attribute rule. But it would be a lot of work to implement that for all FCs in all FGDBs. Doing it in SQL would be better.

Thanks.

6 Comments
Bud
by

It might be possible to query for this kind of thing using open source tools like GDBee and QGIS. The FGDB SQL querying functionality seems pretty comprehensive: https://github.com/AlexArcPy/GDBee

KoryKramer

Hi @Bud what is your workflow? i.e. what are you trying to do with the x, y coordinates once extracted from the shape? Because this can be done using Arcade...

SSWoodward
Status changed to: Needs Clarification
 
AlfredBaldenweck

I'll chime in with a workflow: It'd be great if I could use a definition query to return only points within a certain extent, e.g. west of 108° and north of 36° but south of 42.36565°

KoryKramer

@AlfredBaldenweck that would be Spatial Definition Query which we have Under Consideration and it looks like you've already added your kudos to that idea. Thank you! https://community.esri.com/t5/arcgis-pro-ideas/spatial-definition-query/idi-p/922663

 

AlfredBaldenweck

I think a spatial definition query (as I interpret it) is more about querying based on the relationship between other features, e.g. all the Public Land Survey Townships within a particular county, and would require there to be a feature there. This is more along the lines of Allow SHAPE field to be used in Definition Query - Esri Community, but for views.

 

I apologize, I wasn't reading too carefully and should not have brought up definition queries (although I think that's a valid use, too).