<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: LayerFactory.CreateMosiacLayer returns null for Landsat URL in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/layerfactory-createmosiaclayer-returns-null-for/m-p/1118564#M7368</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can MosaicRule on&amp;nbsp;&lt;SPAN&gt;ImageServiceLayer:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;                    // Get the mosaic rule of the image service.
                    CIMMosaicRule mosaicRule = imageServiceLayer.GetMosaicRule();
                    // Set the mosaic method to be Center.
                    mosaicRule.MosaicMethod = RasterMosaicMethod.Center;
                    // Update the image service with the changed mosaic rule.
                    imageService.SetMosaicRule(mosaicRule);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried and it works.&lt;/P&gt;&lt;P&gt;Another one thing I have found&amp;nbsp; in&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Map-Authoring#working-with-mosaic-layers" target="_self"&gt;https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Map-Authoring#working-with-mosaic-layers&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Similarly, an image service layer that is part of a mosaic layer can be distinguished from other image service layers by using the&amp;nbsp;&lt;/SPAN&gt;ImageMosaicSubLayer&lt;SPAN&gt;&amp;nbsp;class. You could try to investigate ImageMosaicSubLayer functionality&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 19 Nov 2021 07:08:09 GMT</pubDate>
    <dc:creator>GKmieliauskas</dc:creator>
    <dc:date>2021-11-19T07:08:09Z</dc:date>
    <item>
      <title>LayerFactory.CreateMosiacLayer returns null for Landsat URL</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/layerfactory-createmosiaclayer-returns-null-for/m-p/1117563#M7361</link>
      <description>&lt;P&gt;When I run this code with 2.9, it prints: "null layer" then "ImageServiceLayer".&lt;/P&gt;&lt;P&gt;I was expecting to get a MosaicLayer.&amp;nbsp; Am I doing something wrong?&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var uri = new Uri(@"https://landsat2.arcgis.com/arcgis/rest/services/Landsat/MS/ImageServer");
var map = MapView.Active.Map;
await QueuedTask.Run(() =&amp;gt;
{
    var layer = LayerFactory.Instance.CreateMosaicLayer(uri, map,0,"landsat");
    if (layer == null)
        Debug.Print("null layer");
    var layer2 = MapView.Active.Map.Layers[0];
    Debug.Print(layer2.GetType().Name);
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Nov 2021 03:12:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/layerfactory-createmosiaclayer-returns-null-for/m-p/1117563#M7361</guid>
      <dc:creator>KirkKuykendall1</dc:creator>
      <dc:date>2021-11-17T03:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: LayerFactory.CreateMosiacLayer returns null for Landsat URL</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/layerfactory-createmosiaclayer-returns-null-for/m-p/1118050#M7363</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have used ArcGIS Pro sample&amp;nbsp; &lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Map-Authoring/AddRasterLayer" target="_self"&gt;https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Map-Authoring/AddRasterLayer&lt;/A&gt;&amp;nbsp;&amp;nbsp; code to load ImageServiceLayer.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;                // Create a url pointing to the source. In this case it is a url to an image service 
                // which will result in an image service layer being created.
                string dataSoureUrl = @"http://imagery.arcgisonline.com/arcgis/services/LandsatGLS/GLS2010_Enhanced/ImageServer";
                // Note: A url can also point to  
                // 1.) An image on disk or an in a file geodatabase. e.g. string dataSoureUrl = @"C:\temp\a.tif"; This results in a raster layer.
                // 2.) A mosaic dataset in a file gdb e.g. string dataSoureUrl = @"c:\temp\mygdb.gdb\MyMosaicDataset"; This results in a mosaic layer.
                // 3.) A raster or mosaic dataset in an enterprise geodatabase.

                // Create an ImageServiceLayer object to hold the new layer.
                ImageServiceLayer rasterLayer = null;

                // The layer has to be created on the Main CIM Thread (MCT).
                await QueuedTask.Run(() =&amp;gt;
                {
                    // Create a layer based on the url. In this case the layer we are creating is an image service layer.
                    rasterLayer = (ImageServiceLayer)LayerFactory.Instance.CreateLayer(new Uri(dataSoureUrl), myMap);

                    // Check if it is created.
                    if (rasterLayer == null)
                    {
                        ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Failed to create layer for url:" + dataSoureUrl); 
                        return;
                    }
                    
                    // Validate the colorizer to see if the layer is colorized correctly.
                    if (!(rasterLayer.GetColorizer() is CIMRasterRGBColorizer))
                        ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Colorizer does not match for layer created from url: " + dataSoureUrl); 
                });&lt;/LI-CODE&gt;&lt;P&gt;After you can try to check rasterLayer is MosaicLayer and if it is trus cast rasterLayer to MosaicLayer&lt;/P&gt;</description>
      <pubDate>Thu, 18 Nov 2021 06:53:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/layerfactory-createmosiaclayer-returns-null-for/m-p/1118050#M7363</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2021-11-18T06:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: LayerFactory.CreateMosiacLayer returns null for Landsat URL</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/layerfactory-createmosiaclayer-returns-null-for/m-p/1118264#M7365</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/42133"&gt;@GKmieliauskas&lt;/a&gt;&amp;nbsp;thanks for responding!&lt;/P&gt;&lt;P data-unlink="true"&gt;Unfortunately, when I run your code with the Landsat Url,&amp;nbsp;I get a ImageServiceLayer, and not a MosaicLayer.&lt;/P&gt;&lt;P data-unlink="true"&gt;The properties for the resulting layer say there are 3 bands...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KirkKuykendall1_0-1637254140352.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/27790i4C1F69185847598F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KirkKuykendall1_0-1637254140352.png" alt="KirkKuykendall1_0-1637254140352.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And yet &lt;A href="https://landsat2.arcgis.com/arcgis/rest/services/Landsat/MS/ImageServer/info/metadata" target="_self"&gt;the metadata&lt;/A&gt; says it has 9 bands ....&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KirkKuykendall1_1-1637254324267.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/27791i4B36CB6B4A4C0CD3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KirkKuykendall1_1-1637254324267.png" alt="KirkKuykendall1_1-1637254324267.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Other properties in the metadata suggest I should be able to create a mosaiclayer from it, e.g.&amp;nbsp;&lt;SPAN class=""&gt;MaxMosaicImageCount,&amp;nbsp;&lt;SPAN&gt;AllowedMosaicMethods,&amp;nbsp;AvailableMosaicMethods, etc.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Is there a sample anywhere showing how to create a MosaicLayer from a Landsat Imagery URL?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Nov 2021 17:07:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/layerfactory-createmosiaclayer-returns-null-for/m-p/1118264#M7365</guid>
      <dc:creator>KirkKuykendall1</dc:creator>
      <dc:date>2021-11-18T17:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: LayerFactory.CreateMosiacLayer returns null for Landsat URL</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/layerfactory-createmosiaclayer-returns-null-for/m-p/1118564#M7368</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can MosaicRule on&amp;nbsp;&lt;SPAN&gt;ImageServiceLayer:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;                    // Get the mosaic rule of the image service.
                    CIMMosaicRule mosaicRule = imageServiceLayer.GetMosaicRule();
                    // Set the mosaic method to be Center.
                    mosaicRule.MosaicMethod = RasterMosaicMethod.Center;
                    // Update the image service with the changed mosaic rule.
                    imageService.SetMosaicRule(mosaicRule);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried and it works.&lt;/P&gt;&lt;P&gt;Another one thing I have found&amp;nbsp; in&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Map-Authoring#working-with-mosaic-layers" target="_self"&gt;https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Map-Authoring#working-with-mosaic-layers&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Similarly, an image service layer that is part of a mosaic layer can be distinguished from other image service layers by using the&amp;nbsp;&lt;/SPAN&gt;ImageMosaicSubLayer&lt;SPAN&gt;&amp;nbsp;class. You could try to investigate ImageMosaicSubLayer functionality&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Nov 2021 07:08:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/layerfactory-createmosiaclayer-returns-null-for/m-p/1118564#M7368</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2021-11-19T07:08:09Z</dc:date>
    </item>
  </channel>
</rss>

