<?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: Add a raster (.tif) to the active map using .NET SDK for ArcGIS Pro in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/add-a-raster-tif-to-the-active-map-using-net-sdk/m-p/1330766#M10432</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Take a look at the ArcGIS Pro SDK API &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic12166.html" target="_self"&gt;reference&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;string url = @"C:\Images\Italy.tif";
await QueuedTask.Run(() =&amp;gt;
{
  // Create a raster layer using a path to an image.
  // Note: You can create a raster layer from a url, project item, or data connection.
  rasterLayer = LayerFactory.Instance.CreateLayer(new Uri(url), aMap) as RasterLayer;
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or modify sample from your last link&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;                // The layer has to be created on the Main CIM Thread (MCT).
string url = @"C:\Images\Italy.tif"; 
RasterLayer rasterLayer = null;               
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.
                  var layerParams = new LayerCreationParams(new Uri(url));
                  rasterLayer = LayerFactory.Instance.CreateLayer&amp;lt;RasterLayer&amp;gt;(layerParams, myMap);

                  // Check if it is created.
                  if (rasterLayer == null)
                  {
                      ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Failed to create layer for url:" + dataSoureUrl); 
                      return;
                  }
                    
                });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Sep 2023 18:20:54 GMT</pubDate>
    <dc:creator>GKmieliauskas</dc:creator>
    <dc:date>2023-09-20T18:20:54Z</dc:date>
    <item>
      <title>Add a raster (.tif) to the active map using .NET SDK for ArcGIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/add-a-raster-tif-to-the-active-map-using-net-sdk/m-p/1330653#M10431</link>
      <description>&lt;P&gt;this might be an absolute basic question, but how do I add a raster to an active map so that it is listed in the table of content and visible in the map?&lt;/P&gt;&lt;P&gt;I managed to create an empty map, which is then under MapView.Active.Map. when I try to add a simple .tif raster to this map, I fail. I tried various code snippets, but none works for me. the .tif rasterfile is currently in my local directory.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-Raster" target="_blank"&gt;https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-Raster&lt;/A&gt;&amp;nbsp;I found this code snippet (Open raster dataset in a folder), which works as it doesnot raise an error. But it doesn't add the created raster to the map either. So I'm guessing that I need to add it specifically.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic11851.html" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic11851.html&lt;/A&gt; the docu suggests a RemoveLayer method. but I cannot find a addRaster or addLayer method. how is this done??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Map-Authoring/AddRasterLayer" target="_blank"&gt;https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Map-Authoring/AddRasterLayer&lt;/A&gt; I also found this example, but I really don't see/get where they are adding the raster..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for any help&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 15:25:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/add-a-raster-tif-to-the-active-map-using-net-sdk/m-p/1330653#M10431</guid>
      <dc:creator>nadja</dc:creator>
      <dc:date>2023-09-20T15:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: Add a raster (.tif) to the active map using .NET SDK for ArcGIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/add-a-raster-tif-to-the-active-map-using-net-sdk/m-p/1330766#M10432</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Take a look at the ArcGIS Pro SDK API &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic12166.html" target="_self"&gt;reference&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;string url = @"C:\Images\Italy.tif";
await QueuedTask.Run(() =&amp;gt;
{
  // Create a raster layer using a path to an image.
  // Note: You can create a raster layer from a url, project item, or data connection.
  rasterLayer = LayerFactory.Instance.CreateLayer(new Uri(url), aMap) as RasterLayer;
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or modify sample from your last link&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;                // The layer has to be created on the Main CIM Thread (MCT).
string url = @"C:\Images\Italy.tif"; 
RasterLayer rasterLayer = null;               
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.
                  var layerParams = new LayerCreationParams(new Uri(url));
                  rasterLayer = LayerFactory.Instance.CreateLayer&amp;lt;RasterLayer&amp;gt;(layerParams, myMap);

                  // Check if it is created.
                  if (rasterLayer == null)
                  {
                      ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Failed to create layer for url:" + dataSoureUrl); 
                      return;
                  }
                    
                });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 18:20:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/add-a-raster-tif-to-the-active-map-using-net-sdk/m-p/1330766#M10432</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2023-09-20T18:20:54Z</dc:date>
    </item>
  </channel>
</rss>

