<?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 error &amp;quot;Accessor#set Assigning an instance of 'esri.layers.MapImageLayer' which is not a subclass of 'esri.Basemap'&amp;quot; while creating map from mapserver in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/error-quot-accessor-set-assigning-an-instance-of/m-p/1285989#M81057</link>
    <description>&lt;P&gt;Using version 4.26 through npm as an ESM module.&lt;BR /&gt;I came across this error and another somewhat unrelated question with a similar syntax helped me find my bug&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Accessor#set Assigning an instance of 'esri.layers.MapImageLayer' which is not a subclass of 'esri.Basemap'&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The code I tried to use was:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this.imageryLayer= new MapImageLayer({
      url:"URL to a MapServer"
    })

this.map = new Map({
      ground: "world-elevation",
      basemap: this.imageryLayer,
    })&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The reason it failed, was because I didn't cast the MapImageLayer to a BaseMap.&lt;BR /&gt;This piece of code solved it:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this.imageryLayer= new MapImageLayer({
      url:"URL to a MapServer"
    })

this.ImageryBaseMap = new Basemap({
      baseLayers:[this.imageryLayer],
      title: 'Imagery',
      id:'imagery'
    })

this.map = new Map({
      ground: "world-elevation",
      basemap: this.ImageryBaseMap ,
    })&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;This isn't really a question, just added this here for anyone else who might look this up.&lt;/P&gt;</description>
    <pubDate>Fri, 05 May 2023 05:25:10 GMT</pubDate>
    <dc:creator>bogind</dc:creator>
    <dc:date>2023-05-05T05:25:10Z</dc:date>
    <item>
      <title>error "Accessor#set Assigning an instance of 'esri.layers.MapImageLayer' which is not a subclass of 'esri.Basemap'" while creating map from mapserver</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/error-quot-accessor-set-assigning-an-instance-of/m-p/1285989#M81057</link>
      <description>&lt;P&gt;Using version 4.26 through npm as an ESM module.&lt;BR /&gt;I came across this error and another somewhat unrelated question with a similar syntax helped me find my bug&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Accessor#set Assigning an instance of 'esri.layers.MapImageLayer' which is not a subclass of 'esri.Basemap'&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The code I tried to use was:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this.imageryLayer= new MapImageLayer({
      url:"URL to a MapServer"
    })

this.map = new Map({
      ground: "world-elevation",
      basemap: this.imageryLayer,
    })&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The reason it failed, was because I didn't cast the MapImageLayer to a BaseMap.&lt;BR /&gt;This piece of code solved it:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this.imageryLayer= new MapImageLayer({
      url:"URL to a MapServer"
    })

this.ImageryBaseMap = new Basemap({
      baseLayers:[this.imageryLayer],
      title: 'Imagery',
      id:'imagery'
    })

this.map = new Map({
      ground: "world-elevation",
      basemap: this.ImageryBaseMap ,
    })&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;This isn't really a question, just added this here for anyone else who might look this up.&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 05:25:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/error-quot-accessor-set-assigning-an-instance-of/m-p/1285989#M81057</guid>
      <dc:creator>bogind</dc:creator>
      <dc:date>2023-05-05T05:25:10Z</dc:date>
    </item>
  </channel>
</rss>

