Select to view content in your preferred language

Layer/table definition files (readable in a text editor)

12-05-2022 11:28 AM
Status: Implemented
Labels (1)
Honored Contributor

I wonder if it would be useful to have an ArcGIS file type that’s kind of like a .LYR file, except you can view and edit the definition in a text editor. Or edit the definition text directly with Python.

For example, it might be a full blown SELECT query, with SELECT, FROM, and WHERE clauses. It could be thought of as an .SQL file for ArcGIS.

Maybe it would be similar to a query layer, except it’s a file, and works for all supported ArcGIS layer & table types. Not just enterprise geodatabase feature classes/tables.


Something like this would be really useful to me right now! 

I am trying to reconcile layer styles between an old version and new version of a project, the problem being that in the new version a lot of the layer names and features have been changed. There are many hundreds of layers, so I want to find a way to open the old .lyr files, search and replace the old layer names with the new ones, and then save as a new .lyr file I can use to update styling in the new project version. 


@TomKirkpatrick On further investigation, it seems like .lyrx files might already do what we want.

  1. If I open a .lyrx file in a text editor, the source code is in JSON format and is human-readable.
    • The definition query SQL expression is human-readable in the file too.
  2. An EGDB query layer can be saved as a .lyrx file. The full query (SELECT/FROM/WHERE/ETC.) is human-readable in a text editor.
  3. In Pro 3.1 (not 2.6.8), .lyrx files seem to support standalone tables too, not just layers, which is good.


Do you agree that .LYRX files do everything we need (at least in Pro 3.1)?

Or is there other functionality that is needed? Are you able to batch-update .LYRX files using Python? Or does ArcPy not let you do that?



If I understand correctly, somewhere between ArcGIS Pro 2.6.8 and 3.1, functionality was added so that .LYRX files can be created for standalone tables, not just layers.

If that's the case, then I think this idea can be closed. Thanks.


ArcGIS Pro 2.6.8:


ArcGIS Pro 3.1: