Basemap problems with custom base maps & Web AppBuilder

982
1
08-17-2021 10:18 AM
Labels (1)
LouieDowney
New Contributor

I'm having a beast of a time getting some custom base maps to work with ArcGIS online and the web appbuilder.

I've followed the instructions here to make a single layer basemap and add it to my organization's defaults.

https://enterprise.arcgis.com/en/portal/latest/administer/windows/customize-basemaps.htm

(also similar examples from here: https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/living-atlas-custom-basemap-gallery/ & https://www.esri.com/arcgis-blog/products/arcgis-living-atlas/mapping/combining-esri-default-raster-...)

 

The maps show up fine in the online map.  When I bring them into web appbuilder as the default map, they show up no problem.  The issue is if I add the map to the Basemap widget and pick another of the maps as a basemap, it fails to load.

 

When I look at the developer console, I get the following.

TypeError: Cannot read property 'trim' of undefined
at Object.h.trim (init.js:66)
at Object.a.fixUrl (init.js:755)
at A (init.js:1007)
at Object._getServiceInfo (Widget.js?wab_dv=2.21:42)
at Object._addReferenceLayer (Widget.js?wab_dv=2.21:39)
at Object._updateReferenceLayer (Widget.js?wab_dv=2.21:39)
at Object.<anonymous> (Widget.js?wab_dv=2.21:26)
at init.js:65
at e (init.js:105)
at f (init.js:105) "TypeError: Cannot read property 'trim' of undefined\n at Object.h.trim (https://js.arcgis.com/3.37/init.js:66:431)\n at Object.a.fixUrl (https://js.arcgis.com/3.37/init.js:755:266)\n at A (https://js.arcgis.com/3.37/init.js:1007:135)\n at Object._getServiceInfo (https://911district.maps.arcgis.com/apps/webappbuilder/stemapp/widgets/BasemapGallery/Widget.js?wab_...n at Object._addReferenceLayer (https://911district.maps.arcgis.com/apps/webappbuilder/stemapp/widgets/BasemapGallery/Widget.js?wab_...n at Object._updateReferenceLayer (https://911district.maps.arcgis.com/apps/webappbuilder/stemapp/widgets/BasemapGallery/Widget.js?wab_...n at Object.<anonymous> (https://911district.maps.arcgis.com/apps/webappbuilder/stemapp/widgets/BasemapGallery/Widget.js?wab_...n at https://js.arcgis.com/3.37/init.js:65:128\n at e (https://js.arcgis.com/3.37/init.js:105:393)\n at f (https://js.arcgis.com/3.37/init.js:105:182)"
r @ init.js:116

 

I get the same problem when I try to use the developer edition of Web AppBuilder, but I've been able to work around this by editing the config_widgets_BasemapGallery_Widget.json files.

 

By Default when I select my organization base maps, the .json looks like this:

{
        "thumbnailUrl""${appPath}/configs/BasemapGallery/base64Img_widgets_BasemapGallery_Widget_36_1629220158426.png",
        "title""BaseMap Test -  Single Layer",
        "layers": [
          {
            "id""VectorTile_1970",
            "title""Light Gray Base",
            "layerType""VectorTileLayer",
            "maxScale"70.531074,
          },
          {
            "id""17b54d14f5f-layer-2",
            "title""Smith County Grayscale",
            "itemId""b4ece6210e7f4a3da3c8a23362c47d06",
            "layerType""VectorTileLayer",
            "minScale"597012.646703,
            "maxScale"70.531074,
          },
          {
            "id""VectorTile_7117",
            "title""Light Gray Reference",
            "visibility"false,
            "layerType""VectorTileLayer",
            "maxScale"70.531074,
            "isReference"true
          }
        ],
        "spatialReference": {
          "latestWkid"3857,
          "wkid"102100
        }
      },
      {
        "thumbnailUrl""${appPath}/configs/BasemapGallery/base64Img_widgets_BasemapGallery_Widget_36_1629220158427.png",
        "title""Smith County 2020 Aerial with Labels",
        "layers": [
          {
            "id""VectorTile_1970",
            "title""Light Gray Base",
            "layerType""VectorTileLayer",
          },
          {
            "id""17b550b0798-layer-61",
            "title""AerialOnly2020",
            "layerType""ArcGISMapServiceLayer"
          },
          {
            "id""17b40949c0d-layer-49",
            "title""Smith County Aerial Overlay",
            "itemId""c2bd20b1298a4defbba4e4ddfc9d619e",
            "layerType""VectorTileLayer",
            "maxScale"70.531074,
          },
          {
            "id""VectorTile_7117",
            "title""Light Gray Reference",
            "layerType""VectorTileLayer",
            "isReference"true
          }
        ],
        "spatialReference": {
          "latestWkid"3857,
          "wkid"102100
        }
      }

 

But if I edit it like this, everything works fine in the developer edition of web appbuilder.

"basemaps": [
      {
        "title""Smith County - Grayscale",
        "thumbnailUrl""${appPath}/configs/BasemapGallery/base64Img_widgets_BasemapGallery_Widget_36_1629217571837.png",
        "layers": [
          {
            "id""VectorTile_2846",
            "layerType""VectorTileLayer",
            "opacity"1,
            "title""Smith County - Grayscale",
            "type""VectorTileLayer",
            "visibility"true
          },
          {
            "id""VectorTile_1970",
            "layerType""VectorTileLayer",
            "opacity"1,
            "title""Light Gray Base",
            "type""VectorTileLayer",
            "visibility"true
          },
          {
            "id""VectorTile_1645",
            "isReference"true,
            "layerType""VectorTileLayer",
            "opacity"1,
            "title""Dark Gray Reference",
            "type""VectorTileLayer",
            "visibility"true
          }
        ],
        "spatialReference": {
          "wkid""102100"
        }
      },
      {
        "title""Smith County - 2020 Aerial Overlay",
        "thumbnailUrl""${appPath}/configs/BasemapGallery/base64Img_widgets_BasemapGallery_Widget_36_1629217571838.png",
        "layers": [
          {
            "id""VectorTile_1970",
            "layerType""VectorTileLayer",
            "opacity"1,
            "title""Light Gray Base",
            "type""VectorTileLayer",
            "visibility"true
          },
          {
            "id""TiledLayer_Aerial2020_0001",
            "title""Aerial - 2020",
            "layerType""ArcGISMapServiceLayer"
          },
          {
            "id""VectorTile_2846",
            "layerType""VectorTileLayer",
            "opacity"1,
            "title""Smith County Aerial Overlay",
            "type""VectorTileLayer",
            "visibility"true
          }
        ],
        "spatialReference": {
          "wkid""102100"
        }
      },
 
 
Has anyone encountered this before?  Have I done something wrong in creating the organization base maps?  Any help is appreciated.
 
Thanks,
0 Kudos
1 Reply
MichelineMetropolyt1
New Contributor

Did you ever resolve this?  I'm having the same issue.

0 Kudos