How to access standalone tables/feature classes from a ImageServiceLayer?

740
5
11-08-2021 02:33 AM
Jan-Tschada
Esri Contributor

We are trying to access the "metadata/catalog" tables from a ImageServiceLayer (e.g. https://landsat2.arcgis.com/arcgis/rest/services/Landsat/MS/ImageServer). The "Attribute Table" context menu entry opens the "metadata/catalog" tables from a ImageServiceLayer. We ran out of luck by trying to figure out how to access the underlying standalone table of the ImageServiceLayer. We only found a sample using a Mosaic Dataset and access the associated catalog table (ProConcepts Raster · Esri/arcgis-pro-sdk Wiki (github.com))

Is there any sample how to register a custom button by using a condition for ImageServiceLayer (e.g. "esri_mapping_onlyImageServiceLayersSelectedCondition") and access the underlying associated table of the ImageServiceLayer by using a simple row cursor?

GEOINT_ENGINEER_0-1636367315713.png

@CharlesMacleod 

Product Manager
Developers and Location Services
Germany and Switzerland
0 Kudos
5 Replies
Prashant_MukeshMangtani
Esri Contributor

Hi,

Currently there is no way to access that table. Can you provide us with more context on what you are planning to do with that table so we can plan the best way to provide this functionality? What are you looking to do with that table?

-Prashant

0 Kudos
Jan-Tschada
Esri Contributor

We need access for loading the records into our Smart Data Analyser in-memory custom smart table view. So that, any of our customers can easily select/filter/aggregate the underlying image tiles without using not so intuitive SQL statements. Our custom table view has the same behaviour like the attribute or any other record/feature selecting view. For a better understanding take a look at our product page Smart Data Analyser.

Product Manager
Developers and Location Services
Germany and Switzerland
0 Kudos
Jan-Tschada
Esri Contributor

@MatthiasSchenker  showed me a sample using the TableControlContentFactory for populating the underlying table content (ProGuide TableControl · Esri/arcgis-pro-sdk Wiki (github.com)). The TableControlContentFactory works with the ImageServiceLayer as expectet. When we try to access the attribute table by calling ImageServiceLayer::GetRaster()::GetAttributeTable() we only get an uninitialized instance. So far, we ran out of luck again.

if (layer is ImageServiceLayer imageServiceLayer)
{
    await QueuedTask.Run(() =>
    {
        var raster = imageServiceLayer.GetRaster();
        var table = raster.GetAttributeTable();
        if (null != table)
        {
            using (var cursor = table.Search())
            {
                var fieldCount = -1;
                while (cursor.MoveNext())
                {
                    var currentRow = cursor.Current;
                    if (null != currentRow)
                    {
                        if (-1 == fieldCount)
                        {
                            fieldCount = currentRow.GetFields().Count;
                        }
                        for (var fieldIndex = 0; fieldIndex < fieldCount; fieldIndex++)
                        {
                            var value = currentRow[fieldIndex];
                            if (null != value)
                            {

                            }
                        }
                    }
                }
            }
        }
    });
}
Product Manager
Developers and Location Services
Germany and Switzerland
0 Kudos
Jan-Tschada
Esri Contributor

@CharlesMacleod do you know any workaround for accessing the "attribute table" from a Image Service Layer\Raster Layer with Metadata or is this not possible with the current Pro SDK?

We only found ImageServiceLayer::GetRaster()::GetAttributeTable() returning a null reference, so far.

 

Product Manager
Developers and Location Services
Germany and Switzerland
0 Kudos
Chris_Musial
New Contributor

We are also interested in this. We are using the historical topographic ArcGIS Online service. We would like to query a particular location to find the historical topos available for that location, including date of acquisition, scale, etc. This is critical for one of the workflows.