Select to view content in your preferred language

How can I get listSymbolsFromGallery() to pull from a style file?

289
0
06-28-2023 06:02 PM
AndrewGilbert
Occasional Contributor

The documentation for the Symbol.listSymbolsFromGallery() method says (emphasis mine):

listSymbolsFromGallery provides a mechanism to return a list of symbols that exists in a system or project style gallery.

If I create a layer in memory through a geoprocessing tool, using only raw paths as inputs and not existing map layers, then the resulting layer is not associated with any project (I think). So, if I then call listSymbolsFromGallery() like so...

 

symbols = my_layer.symbology.renderer.symbol.listSymbolsFromGallery(symbol_name)

 

...then Pro apparently only pulls system symbols and not project symbols. Makes sense.

However, if I then add that layer to a map in a project that has a style file added, and save the project...

 

aprx_map.addLayer(my_layer)
aprx.save()
symbols = my_layer.symbology.renderer.symbol.listSymbolsFromGallery(symbol_name)

 

 ...then listSymbolsFromGallery() still does not list the symbols in the project's style file.

How can I get listSymbolsFromGallery() to pull symbols from a style file?

Tags (1)
0 Kudos
0 Replies