Issue with MosaicRule.WhereClause?

624
3
06-10-2019 02:54 PM
ChrisGreen
New Contributor III

I'm attempting to set the WhereClause on a MosaicRule against the ESRI Landsat imagery service. I can lock the raster to a list of ObjectIds, but a something like Name='LC82220782017324LGN00' doesn't work. I use to do something similar in ArcObjects with no issue. Am I doing something wrong? Thanks for your time, cg.

0 Kudos
3 Replies
Prashant_MukeshMangtani
Esri Contributor

Chris,

Did you try the same query using the layer properties to see if its valid?

-Prashant

0 Kudos
ChrisGreen
New Contributor III

Yes, that did work when I did it manually (i.e., setting definition query of layer added). Is there a way to programmatically do the same thing, as I couldn't figure that out. I'd assume the where clause of the mosaic rule, which worked in ArcObjects, would work in the Pro SDK.

Thanks for your help, cg.

0 Kudos
ChrisGreen
New Contributor III

A big thanks to Kimberly (ESRI support) and ESRI for figuring this out for me.  Here's how to work this using a definition expression which gets the job done for my needs.

Map _map = await FindOpenExistingMapAsync("Map");
            
string layerName = "Landsat\\MS";
string imgServicePath = "http://landsat.arcgis.com/arcgis/rest/services/Landsat/MS/ImageServer";

ImageServiceLayer isLyr = null;

await QueuedTask.Run(() =>
            {
                isLyr = (ImageServiceLayer)LayerFactory.Instance.CreateRasterLayer(new Uri(imgServicePath),
                _map, LayerPosition.AutoArrange, layerName);
                
                
                CIMImageServiceLayer cimLyr = isLyr.GetDefinition() as CIMImageServiceLayer;
                CIMFeatureTable cimTable = cimLyr.FeatureTable;
                cimTable.DefinitionExpression = "Name IN ('LC80440302019155LGN00','LC80440312019155LGN00')";
                Layer layer = isLyr as Layer;
                layer.SetDefinition(cimLyr);
            });

0 Kudos