Get FileGDB name(s) of MapView.Active.GetSelectedLayers()

332
2
04-04-2023 01:05 AM
Zoltan_Szecsei
New Contributor II

Hi,

I am using OnMapSelectionChangedEvent()  to trap when a user clicks in the TOC.

How can I get the FileGDB (or SHP, or Raster image etc) name from the clicked Map item?

Yes, I have to filter out Group names etc from the Selected Layers.

 

Thanks in advance,

Zoltan

Tags (2)
0 Kudos
2 Replies
StephenRhea_NV5
Occasional Contributor

Within a QueuedTask, you can get the data connection from the feature layer, then look at its workspace connection string. It'll have a value like "DATABASE=path_to_database.gdb" or "DATABASE=path_to_folder" in the case of a file system raster.

 

await QueuedTask.Run(() =>
{
    var layerConnection = featureLayer.GetDataConnection() as CIMStandardDataConnection;
    var workspaceConnectionString = layerConnection.WorkspaceConnectionString;
});

 

0 Kudos
Zoltan_Szecsei
New Contributor II

Hi Stephen,

Megathanks - I'll give this a try tomorrow.

 

Regards,

Zoltan