<?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: Loading layer with different SpatialReference of Map in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-layer-with-different-spatialreference-of/m-p/1150293#M76571</link>
    <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;We do not throw an error in this case. We can log error when this happens but I am not sure when it will happen. In any case, we will document this behavior clearly in the MapView doc so that it will help to troubleshoot this.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 03 Mar 2022 18:48:45 GMT</pubDate>
    <dc:creator>UndralBatsukh</dc:creator>
    <dc:date>2022-03-03T18:48:45Z</dc:date>
    <item>
      <title>Loading layer with different SpatialReference of Map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-layer-with-different-spatialreference-of/m-p/1148995#M76517</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to load a layer that has different&amp;nbsp;SpatialReference of mapview. I know I need to project it to the new coordinates but i would expect getting an error when trying to add the layer to the map but that is not the case, i get nothing instead and i can't know that the layer couldn't add.&lt;/P&gt;&lt;P&gt;I added a code the reproduce the issue, you will see that&amp;nbsp;view.when and&amp;nbsp;view.whenLayerView are not being called but also their errorCallback/exception handling do not execute.&lt;/P&gt;&lt;P&gt;Is there any way to know that a layer view or a view failed to create?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;html&amp;gt;&lt;BR /&gt;&amp;lt;head&amp;gt;&lt;BR /&gt;&amp;lt;meta charset="utf-8" /&amp;gt;&lt;BR /&gt;&amp;lt;meta&lt;BR /&gt;name="viewport"&lt;BR /&gt;content="initial-scale=1,maximum-scale=1,user-scalable=no"&lt;BR /&gt;/&amp;gt;&lt;BR /&gt;&amp;lt;title&amp;gt;&lt;BR /&gt;MapImageLayer - Wrong spatialReference&lt;BR /&gt;&amp;lt;/title&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;link&lt;BR /&gt;rel="stylesheet"&lt;BR /&gt;href="&lt;A href="https://js.arcgis.com/4.22/esri/themes/light/main.css" target="_blank"&gt;https://js.arcgis.com/4.22/esri/themes/light/main.css&lt;/A&gt;"&lt;BR /&gt;/&amp;gt;&lt;BR /&gt;&amp;lt;script src="&lt;A href="https://js.arcgis.com/4.22/" target="_blank"&gt;https://js.arcgis.com/4.22/&lt;/A&gt;"&amp;gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;/*****************************************************************&lt;BR /&gt;*demo code loading service with incorrect spatialReference, result- the layer is loaded but view.when() and view.whenLayerView() are not being triggerd&lt;BR /&gt;*and there are no errors&lt;BR /&gt;*****************************************************************/&lt;BR /&gt;require(["esri/Map",&lt;BR /&gt;"esri/views/MapView",&lt;BR /&gt;"esri/layers/MapImageLayer",&lt;BR /&gt;"esri/widgets/LayerList",&lt;BR /&gt;"esri/widgets/Expand",&lt;BR /&gt;"esri/geometry/SpatialReference"], (&lt;BR /&gt;Map,&lt;BR /&gt;MapView,&lt;BR /&gt;MapImageLayer,&lt;BR /&gt;LayerList,&lt;BR /&gt;Expand,&lt;BR /&gt;SpatialReference&lt;BR /&gt;) =&amp;gt; {&lt;BR /&gt;&lt;BR /&gt;const layer = new MapImageLayer({&lt;BR /&gt;url: "&lt;A href="https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer" target="_blank"&gt;https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer&lt;/A&gt;"&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;const map = new Map({&lt;BR /&gt;layers: [layer]&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;const view = new MapView({&lt;BR /&gt;container: "viewDiv",&lt;BR /&gt;map: map,&lt;BR /&gt;spatialReference: new SpatialReference({ wkid: 102100 }),&lt;BR /&gt;zoom: 3&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;const layerList = new LayerList({&lt;BR /&gt;view: view&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;const layersExpand = new Expand({&lt;BR /&gt;view: view,&lt;BR /&gt;content: layerList,&lt;BR /&gt;expandIconClass: "esri-icon-layers",&lt;BR /&gt;id: "expandWidget"&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;view.ui.add(layersExpand, "top-right");&lt;/P&gt;&lt;P&gt;layer.when(() =&amp;gt; {&lt;BR /&gt;console.log('layer loaded')&lt;BR /&gt;},&lt;BR /&gt;() =&amp;gt; {&lt;BR /&gt;console.log('failed to load layer')&lt;BR /&gt;&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/*****************************************************************&lt;BR /&gt;*layer was loaded but this is not getting called and no error callback&lt;BR /&gt;*****************************************************************/&lt;BR /&gt;view.when(() =&amp;gt; {&lt;BR /&gt;console.log('view is ready')&lt;BR /&gt;}, ()=&amp;gt; {&lt;BR /&gt;console.log('view error')&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/*****************************************************************&lt;BR /&gt;* layer view is not created here and we do not get any error&lt;BR /&gt;*****************************************************************/&lt;BR /&gt;view.whenLayerView(layer)&lt;BR /&gt;.then(function (layerView) {&lt;BR /&gt;console.log('layer view created')&lt;BR /&gt;})&lt;BR /&gt;.catch(function (error) {&lt;BR /&gt;console.log('creating layer view failed')&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;});&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;style&amp;gt;&lt;BR /&gt;html,&lt;BR /&gt;body {&lt;BR /&gt;padding: 0;&lt;BR /&gt;margin: 0;&lt;BR /&gt;height: 100%;&lt;BR /&gt;width: 100%;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;#viewDiv {&lt;BR /&gt;position: absolute;&lt;BR /&gt;right: 0;&lt;BR /&gt;left: 0;&lt;BR /&gt;top: 0;&lt;BR /&gt;bottom: 60px;&lt;BR /&gt;}&lt;BR /&gt;&amp;lt;/style&amp;gt;&lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;body&amp;gt;&lt;BR /&gt;&amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2022 07:25:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-layer-with-different-spatialreference-of/m-p/1148995#M76517</guid>
      <dc:creator>HanochS</dc:creator>
      <dc:date>2022-03-01T07:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: Loading layer with different SpatialReference of Map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-layer-with-different-spatialreference-of/m-p/1149176#M76535</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Nothing is being displayed because your map does not have a basemap where it can derive &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#scale" target="_self"&gt;view.scale&lt;/A&gt; and &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#constraints" target="_self"&gt;view.constraints.lods&lt;/A&gt;&amp;nbsp;from. The view.zoom levels are as convenient numbers used as a shorthand for predetermined scale values. Scale values are derived from your basemaps.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If you want to display your layer without a basemap, then you need to set the scale and center of your view. &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const view = new MapView({
  container: "viewDiv",
  map: map,
  spatialReference: {
    wkid: 102100
  },
  scale: 36978595.474472,
  center: [-100, 35]
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You may find &lt;A href="https://developers.arcgis.com/documentation/mapping-apis-and-services/reference/zoom-levels-and-scale/" target="_self"&gt;this document&lt;/A&gt; useful as it describes about zoom levels and scales.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2022 17:01:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-layer-with-different-spatialreference-of/m-p/1149176#M76535</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2022-03-01T17:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: Loading layer with different SpatialReference of Map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-layer-with-different-spatialreference-of/m-p/1149453#M76542</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for the reply. I will check the suggested solution. but still, why there is no error when trying to do that kind of thing? what is the error callback/error handling is for?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 08:23:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-layer-with-different-spatialreference-of/m-p/1149453#M76542</guid>
      <dc:creator>HanochS</dc:creator>
      <dc:date>2022-03-02T08:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: Loading layer with different SpatialReference of Map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-layer-with-different-spatialreference-of/m-p/1150293#M76571</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;We do not throw an error in this case. We can log error when this happens but I am not sure when it will happen. In any case, we will document this behavior clearly in the MapView doc so that it will help to troubleshoot this.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2022 18:48:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-layer-with-different-spatialreference-of/m-p/1150293#M76571</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2022-03-03T18:48:45Z</dc:date>
    </item>
  </channel>
</rss>

