I would like to be able to query by z-value in the Select by Attributes. For example, query all the assets I have in the UN that are lower than 3 ft. Right now if I want to do this I'm using FME to read out the geometry and evaluate it.
My workaround to this: symbolize features by their z values (everything over 3 ft vs everything under 3ft) and then toggle off the undesired values, then zoom to the extent and "Select visible features".
The clue is in the name, select layer by attributes. Properties of geometries (in your case the Z value) are not attributes, which are fields in an attribute table. Hence its not possible to select features on the map by Z values embedded in the geometry. It would be great if ESRI expose geometry properties but I suspect that wont happen any time soon.
But you can query and select with a few lines of python code which you could run in a tool in modelbuilder or in the python console. Here is a bare bones script, note the warnings. You will want to add error trapping and catch edge case scenarios.
# Code assumes single part point geometry # Code assumes at least 2 points are selected (i.e. two points where Z < than 3 feet), that ensures the conversion to a tuple works as expected. l = list() with arcpy.da.SearchCursor("test", ["OID@", "SHAPE@Z"]) as cursor: for oid, z in cursor: if z < 3: l.append(oid) arcpy.management.SelectLayerByAttribute('test', 'NEW_SELECTION',f"OBJECTID in {tuple(l)}")
Sign in to post, follow content, and more. New here? Register for free.