.LYRX and .MAPX files — Store selection SQL expression in file's JSON source

292
2
01-08-2024 01:39 PM
Status: Open
Labels (1)
Bud
by
Notable Contributor

ArcGIS Pro 3.2.1; mobile geodatabase

Scenario:

I’ve added a mobile geodatabase FC to the map. I’ve made a selection using Select By Attributes:

TYPE = 'b'

I’ve exported the layer as a .LYRX file. And I’ve exported the map as a .MAPX file.

In a new ArcGIS Pro session/project, I’ve added the .LYRX and .MAPX files to the project. In both layers, the selection has been preserved; the features are selected.

If I look at the source code of the .LYRX and .MAPX files in a text editor, I don’t see any information about the selectionstored in the JSON content. 

Idea:

I don't know where the selection SQL expression is stored, but it doesn’t seem to be stored in the .LYRX and .MAPX files. 

To me, the most useful place for the selection SQL expression would be in the .LYRX and .MAPX files -- with the SQL expression being human-readable in the JSON source. Could those files be enhanced to contain that info?

Esri Case #03521279 - .LYRX and .MAPX files: Where is selection SQL expression stored?

2 Comments
JoshuaBixby

This won't really be possible because a layer knows what ObjectIDs are selected, but it doesn't know how they were selected.  There are numerous ways to select records, and what is exported in the LYRX or MAPX files are binary references to those ObjectIDs and not references to the tools or methods used to select the records.

Bud
by

@JoshuaBixby Good to know. Thanks.

I wonder if the ideal logic would look like this:

1. ArcGIS Pro would track how a selection was created.

2. When exporting the .LYRX and .MAPX files, if the source of the selection is Select By Attributes, then record the SQL expression in the output file’s JSON as human readable SQL text.

3. Else, if the source of the selection is just a list of OBJECTIDs, such as from a user manually selecting rows in the attribute table, then store them as binary within the JSON, as usual.

Would that work? Or something better?


Related: Track/display how a selection was made and what SQL criteria was used