<?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: Custom basemap with ESRI default basemaps in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-basemap-with-esri-default-basemaps/m-p/1221717#M79014</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/80707"&gt;@ADITYAKUMAR1&lt;/a&gt;&amp;nbsp;- you can do this via the updateBasemapsCallback property, here's an example:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let basemapGallery = new BasemapGallery({
   view: view,
   source: {
     query: {
       title: "United States Basemaps",
       owner: "Esri_cy_US"
     },
     updateBasemapsCallback: function(items) {
       // create custom basemap to be added to the array of portal basemaps
       let bm = new Basemap({
         portalItem: {
           id: "8dda0e7b5e2d4fafa80132d59122268c"  // WGS84 Streets Vector webmap
         }
       });
       // add basemap to the array
       items.push(bm);
       // return the array of basemaps
       return items;
     }
   }
});&lt;/LI-CODE&gt;&lt;P&gt;Here's the snippet within a test app:&amp;nbsp;&lt;A href="https://codepen.io/annefitz/pen/rNvPKNr" target="_blank"&gt;https://codepen.io/annefitz/pen/rNvPKNr&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The documentation can be found here:&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery-support-PortalBasemapsSource.html#UpdateBasemapsCallback" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery-support-PortalBasemapsSource.html#UpdateBasemapsCallback&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Oct 2022 18:57:49 GMT</pubDate>
    <dc:creator>AnneFitz</dc:creator>
    <dc:date>2022-10-13T18:57:49Z</dc:date>
    <item>
      <title>Custom basemap with ESRI default basemaps</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-basemap-with-esri-default-basemaps/m-p/1221679#M79011</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Is there a way we can add our custom base map along with ESRI default base maps in the basemap gallery widget in arcgis JavaScript 4.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In api 3 we had somthing like "showArcGISBasemaps = true" which used to fetch all the basemaps. Do we have something similar in version 4?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Aditya Kumar&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 17:37:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-basemap-with-esri-default-basemaps/m-p/1221679#M79011</guid>
      <dc:creator>ADITYAKUMAR1</dc:creator>
      <dc:date>2022-10-13T17:37:06Z</dc:date>
    </item>
    <item>
      <title>Re: Custom basemap with ESRI default basemaps</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-basemap-with-esri-default-basemaps/m-p/1221717#M79014</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/80707"&gt;@ADITYAKUMAR1&lt;/a&gt;&amp;nbsp;- you can do this via the updateBasemapsCallback property, here's an example:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let basemapGallery = new BasemapGallery({
   view: view,
   source: {
     query: {
       title: "United States Basemaps",
       owner: "Esri_cy_US"
     },
     updateBasemapsCallback: function(items) {
       // create custom basemap to be added to the array of portal basemaps
       let bm = new Basemap({
         portalItem: {
           id: "8dda0e7b5e2d4fafa80132d59122268c"  // WGS84 Streets Vector webmap
         }
       });
       // add basemap to the array
       items.push(bm);
       // return the array of basemaps
       return items;
     }
   }
});&lt;/LI-CODE&gt;&lt;P&gt;Here's the snippet within a test app:&amp;nbsp;&lt;A href="https://codepen.io/annefitz/pen/rNvPKNr" target="_blank"&gt;https://codepen.io/annefitz/pen/rNvPKNr&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The documentation can be found here:&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery-support-PortalBasemapsSource.html#UpdateBasemapsCallback" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery-support-PortalBasemapsSource.html#UpdateBasemapsCallback&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 18:57:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-basemap-with-esri-default-basemaps/m-p/1221717#M79014</guid>
      <dc:creator>AnneFitz</dc:creator>
      <dc:date>2022-10-13T18:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: Custom basemap with ESRI default basemaps</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-basemap-with-esri-default-basemaps/m-p/1221733#M79015</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/115266"&gt;@AnneFitz&lt;/a&gt;&amp;nbsp;This really helped. Thanks a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 19:17:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-basemap-with-esri-default-basemaps/m-p/1221733#M79015</guid>
      <dc:creator>ADITYAKUMAR1</dc:creator>
      <dc:date>2022-10-13T19:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: Custom basemap with ESRI default basemaps</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-basemap-with-esri-default-basemaps/m-p/1248511#M79917</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/115266"&gt;@AnneFitz&lt;/a&gt;&amp;nbsp;I updated the code with a basemap layer .&lt;/P&gt;&lt;P&gt;this.basemapGallery = new BasemapGallery({&lt;BR /&gt;view: this.map.mapView,&lt;BR /&gt;container: this.basemapGalleryDiv,&lt;BR /&gt;source: {&lt;BR /&gt;query: {&lt;BR /&gt;title: "Custom Basemap",&lt;BR /&gt;},&lt;BR /&gt;updateBasemapsCallback: (items) =&amp;gt; {&lt;BR /&gt;if (this.customBasemap) {&lt;BR /&gt;items.push(this.customBasemap);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;console.log(items);&lt;BR /&gt;&lt;BR /&gt;return items;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And this works as expected. A new baselayer is being added to the basemap gallery but it works only on first click. If we choose any other basemap and when we comes back to our custom basemap, the basemap doesnt load again. Any idea why?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2023 17:36:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-basemap-with-esri-default-basemaps/m-p/1248511#M79917</guid>
      <dc:creator>ADITYAKUMAR1</dc:creator>
      <dc:date>2023-01-16T17:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: Custom basemap with ESRI default basemaps</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-basemap-with-esri-default-basemaps/m-p/1248749#M79939</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/80707"&gt;@ADITYAKUMAR1&lt;/a&gt;&amp;nbsp;- Could you provide a codepen that reproduces your error? Or is there an error message that shows in the console that you could share?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 16:14:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-basemap-with-esri-default-basemaps/m-p/1248749#M79939</guid>
      <dc:creator>AnneFitz</dc:creator>
      <dc:date>2023-01-17T16:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: Custom basemap with ESRI default basemaps</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-basemap-with-esri-default-basemaps/m-p/1248778#M79944</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/115266"&gt;@AnneFitz&lt;/a&gt;&amp;nbsp;I am sorry I wont be able to help on that but if you want I can share a video no how its behaving. While clicking on the custom basemap second time&amp;nbsp; there are no error in the console and there is no network traffic as well to hit the custom basemap url.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 17:02:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-basemap-with-esri-default-basemaps/m-p/1248778#M79944</guid>
      <dc:creator>ADITYAKUMAR1</dc:creator>
      <dc:date>2023-01-17T17:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: Custom basemap with ESRI default basemaps</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-basemap-with-esri-default-basemaps/m-p/1248792#M79946</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/115266"&gt;@AnneFitz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;BR /&gt;&amp;lt;html lang="en"&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;BasemapGallery widget | Sample | ArcGIS Maps SDK for JavaScript 4.25&lt;BR /&gt;&amp;lt;/title&amp;gt;&lt;BR /&gt;&amp;lt;link&lt;BR /&gt;rel="stylesheet"&lt;BR /&gt;href="&lt;A href="https://js.arcgis.com/4.25/esri/themes/light/main.css" target="_blank"&gt;https://js.arcgis.com/4.25/esri/themes/light/main.css&lt;/A&gt;"&lt;BR /&gt;/&amp;gt;&lt;BR /&gt;&amp;lt;style&amp;gt;&lt;BR /&gt;html,&lt;BR /&gt;body,&lt;BR /&gt;#viewDiv {&lt;BR /&gt;padding: 0;&lt;BR /&gt;margin: 0;&lt;BR /&gt;height: 100%;&lt;BR /&gt;width: 100%;&lt;BR /&gt;}&lt;BR /&gt;&amp;lt;/style&amp;gt;&lt;BR /&gt;&amp;lt;script src="&lt;A href="https://js.arcgis.com/4.25/" target="_blank"&gt;https://js.arcgis.com/4.25/&lt;/A&gt;"&amp;gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;require([&lt;BR /&gt;"esri/Map",&lt;BR /&gt;"esri/views/SceneView",&lt;BR /&gt;"esri/widgets/BasemapGallery",&lt;BR /&gt;"esri/Basemap",&lt;BR /&gt;"esri/widgets/BasemapLayerList"&lt;BR /&gt;], (Map, SceneView, BasemapGallery, Basemap,&lt;BR /&gt;BasemapLayer) =&amp;gt; {&lt;BR /&gt;const map = new Map({&lt;BR /&gt;basemap: "gray-vector"&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;const view = new SceneView({&lt;BR /&gt;container: "viewDiv",&lt;BR /&gt;map: map,&lt;BR /&gt;center: [139.68, 35.68],&lt;BR /&gt;zoom: 3&lt;BR /&gt;});&lt;BR /&gt;customBasemapLayer = new BasemapLayer("&lt;A href="http://gisbasemap.ecan.govt.nz/arcgis/rest/services/SimpleBasemap/MapServer" target="_blank"&gt;http://gisbasemap.ecan.govt.nz/arcgis/rest/services/SimpleBasemap/MapServer&lt;/A&gt;");&lt;BR /&gt;customBasemap = new Basemap({&lt;BR /&gt;layers: [customBasemapLayer],&lt;BR /&gt;id: "test",&lt;BR /&gt;title:"test",&lt;BR /&gt;thumbnailUrl: "&lt;A href="http://gisbasemap.ecan.govt.nz/arcgis/rest/services/SimpleBasemap/MapServer/info/thumbnail" target="_blank"&gt;http://gisbasemap.ecan.govt.nz/arcgis/rest/services/SimpleBasemap/MapServer/info/thumbnail&lt;/A&gt;"&lt;BR /&gt;});&lt;BR /&gt;// const basemapGallery = new BasemapGallery({&lt;BR /&gt;// view: view&lt;BR /&gt;// });&lt;BR /&gt;const basemapGallery = new BasemapGallery({&lt;BR /&gt;view: view,&lt;BR /&gt;&lt;BR /&gt;source: {&lt;BR /&gt;query: {&lt;BR /&gt;title: "Custom Basemap",&lt;BR /&gt;},&lt;BR /&gt;updateBasemapsCallback: (items) =&amp;gt; {&lt;BR /&gt;if (this.customBasemap) {&lt;BR /&gt;items.push(this.customBasemap);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;console.log(items);&lt;BR /&gt;&lt;BR /&gt;return items;&lt;BR /&gt;// return items;&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;// Add the widget to the top-right corner of the view&lt;BR /&gt;view.ui.add(basemapGallery, {&lt;BR /&gt;position: "top-right"&lt;BR /&gt;});&lt;BR /&gt;});&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;BR /&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this will help&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 17:24:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-basemap-with-esri-default-basemaps/m-p/1248792#M79946</guid>
      <dc:creator>ADITYAKUMAR1</dc:creator>
      <dc:date>2023-01-17T17:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Custom basemap with ESRI default basemaps</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-basemap-with-esri-default-basemaps/m-p/1249375#M79956</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/115266"&gt;@AnneFitz&lt;/a&gt;&amp;nbsp;There was a problem with defining the custom basemap. I rectified it and its working fine. Your code was perfect.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 08:32:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-basemap-with-esri-default-basemaps/m-p/1249375#M79956</guid>
      <dc:creator>ADITYAKUMAR1</dc:creator>
      <dc:date>2023-01-19T08:32:50Z</dc:date>
    </item>
  </channel>
</rss>

