<?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: Internal error: The raster layer does not have a spatial reference. in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/internal-error-the-raster-layer-does-not-have-a/m-p/1249244#M11603</link>
    <description>&lt;P&gt;Are able to view the raster layer though?, If yes, then it's fine because the issue with rater layer reporting incorrect viewstate and error is already logged internally in our bug tracking system but hasn't been prioritized yet.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Jan 2023 21:02:19 GMT</pubDate>
    <dc:creator>PreetiMaske</dc:creator>
    <dc:date>2023-01-18T21:02:19Z</dc:date>
    <item>
      <title>Internal error: The raster layer does not have a spatial reference.</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/internal-error-the-raster-layer-does-not-have-a/m-p/1244694#M11575</link>
      <description>&lt;P&gt;Attempting to load a set of PNG raster files but seeing the following error from the LayerViewStateChanged event.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Internal error: The raster layer does not have a spatial reference.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I don't see any way to set the spatial reference on the RasterLayer as the property only has a getter.&amp;nbsp; Also, I have world files that are in the same directory as the png files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;        private async Task LoadMap()
        {
            // create map
            Map myMap = new Map(SpatialReference.Create(3857));
            
            myMap.Basemap = new Basemap(BasemapStyle.ArcGISOceansBase);
            MyMapView.Map = myMap;

            MyMapView.LayerViewStateChanged += MyMapView_LayerViewStateChanged;

            // Get the file name
            string filepath = GetFilesPath();
            var files = Directory.GetFiles(filepath, "*.png");

            foreach (var file in files)
            {
                // Load the raster file
                Raster myRasterFile = new Raster(file);

                // Create the layer
                RasterLayer myRasterLayer = new RasterLayer(myRasterFile);

                // Add the layer to the map
                myMap.OperationalLayers.Add(myRasterLayer);

                try
                {
                    // Wait for the layer to load
                    await myRasterLayer.LoadAsync();

                    // Set the viewpoint
                    await MyMapView.SetViewpointGeometryAsync(myRasterLayer.FullExtent);
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.ToString(), "Error");
                }
            }
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample - World File Contents&lt;/P&gt;&lt;P&gt;9.31098696461825&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;-18.587360594795538&lt;BR /&gt;-9166533.732955951&lt;BR /&gt;3235852.4356317967&lt;/P&gt;</description>
      <pubDate>Sat, 31 Dec 2022 13:46:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/internal-error-the-raster-layer-does-not-have-a/m-p/1244694#M11575</guid>
      <dc:creator>NathanMoebus</dc:creator>
      <dc:date>2022-12-31T13:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: Internal error: The raster layer does not have a spatial reference.</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/internal-error-the-raster-layer-does-not-have-a/m-p/1249244#M11603</link>
      <description>&lt;P&gt;Are able to view the raster layer though?, If yes, then it's fine because the issue with rater layer reporting incorrect viewstate and error is already logged internally in our bug tracking system but hasn't been prioritized yet.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 21:02:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/internal-error-the-raster-layer-does-not-have-a/m-p/1249244#M11603</guid>
      <dc:creator>PreetiMaske</dc:creator>
      <dc:date>2023-01-18T21:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: Internal error: The raster layer does not have a spatial reference.</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/internal-error-the-raster-layer-does-not-have-a/m-p/1251107#M11616</link>
      <description>&lt;P&gt;Negative - I cannot see the raster layer.&amp;nbsp; Here is a dump of both the Error and Status props of the LayerViewState from the LayerViewStateChanged event.&amp;nbsp; As you can see, status is 'NotVisible | Error'.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;? e.LayerViewState.Status&lt;/STRONG&gt;&lt;BR /&gt;NotVisible | Error&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;? e.LayerViewState.Error&lt;/STRONG&gt;&lt;BR /&gt;{"Internal error: The raster layer does not have a spatial reference."}&lt;BR /&gt;Data: {System.Collections.ListDictionaryInternal}&lt;BR /&gt;ErrorCode: 18&lt;BR /&gt;HResult: -2146233088&lt;BR /&gt;HelpLink: null&lt;BR /&gt;InnerException: null&lt;BR /&gt;Message: "Internal error: The raster layer does not have a spatial reference."&lt;BR /&gt;Source: null&lt;BR /&gt;StackTrace: null&lt;BR /&gt;TargetSite: null&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Here is a dump of the e.Layer property as well.&amp;nbsp; As you can see, the 'IsVisible' property is indeed true which contradicts the status above.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;? e.Layer&lt;/STRONG&gt;&lt;BR /&gt;{Esri.ArcGISRuntime.Mapping.RasterLayer}&lt;BR /&gt;Attribution: ""&lt;BR /&gt;Brightness: 0&lt;BR /&gt;CanChangeVisibility: true&lt;BR /&gt;Contrast: 0&lt;BR /&gt;Description: ""&lt;BR /&gt;FullExtent: {Envelope[XMin=-0.5, YMin=-255.5, XMax=255.5, YMax=0.5, WkText=]}&lt;BR /&gt;FullTimeExtent: null&lt;BR /&gt;Gamma: 0&lt;BR /&gt;Id: "we/IX5k5TjS3Pdb9TuAsdQ"&lt;BR /&gt;IsIdentifyEnabled: true&lt;BR /&gt;IsPopupEnabled: true&lt;BR /&gt;IsTimeFilteringEnabled: true&lt;BR /&gt;IsVisible: true&lt;BR /&gt;Item: null&lt;BR /&gt;LoadError: null&lt;BR /&gt;LoadStatus: Loaded&lt;BR /&gt;MaxScale: 1500&lt;BR /&gt;MinScale: 2500&lt;BR /&gt;Name: "img_-15657522.123893805_-1799999.9999999995.png"&lt;BR /&gt;Opacity: 1&lt;BR /&gt;PopupDefinition: null&lt;BR /&gt;Raster: {Esri.ArcGISRuntime.Rasters.Raster}&lt;BR /&gt;Renderer: null&lt;BR /&gt;ShowInLegend: true&lt;BR /&gt;SpatialReference: null&lt;BR /&gt;SublayerContents: {Esri.ArcGISRuntime.Internal.SublayerContentCollection}&lt;BR /&gt;SupportsTimeFiltering: false&lt;BR /&gt;TimeInterval: null&lt;BR /&gt;TimeOffset: null&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2023 01:42:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/internal-error-the-raster-layer-does-not-have-a/m-p/1251107#M11616</guid>
      <dc:creator>NathanMoebus</dc:creator>
      <dc:date>2023-01-25T01:42:08Z</dc:date>
    </item>
  </channel>
</rss>

