Empty BaseMap not working

1514
0
08-01-2016 10:41 PM
JustinCornell
New Contributor III

Utlimately if I could capture a BaseMap load failure that would good enough but I can't figure out how to do that so I've tried these things below.  If you know how to capture a BaseMap load failure please, please, please give me an example!

I'm trying to load a dynamicMapService with no basemap specified and this works.  Problem occurs when trying to toggle to a new base map like "gray" after loading with no basemap.  The base map's don't actually load on the map although the map's "basemap-change" event fires.  They dynamicMapService is in the same coordinate system as the "gray" basemap. Any ideas why they won't show up?

Since I couldn't get the previous to work, I tried constructing my own basemap in code but it doesn't appear to work because it says Unknown basemap layer type: "WebTiledLayer" found in basemap definition. It clearly states in the documentation this is a valid option for type (BasemapLayer | API Reference | ArcGIS API for JavaScript 3.17).  Any help to get a basemap defined that just returns a single empty tile would be greatly appreciated!

I'm using the 3.16 API version

new Map({
  //this idea was taken from https://community.esri.com/message/581669
  basemap: new Basemap({ 
  id: "BlankBaseMap",
  title:"Blank BaseMap",
  layers: [  
   new BasemapLayer({
   templateUrl: "http://localhost:62470/Images/blankTile.png", //template will always return an empty image
   type: "WebTiledLayer",
   viewModulePaths: {},  
   initialExtent: new Extent(-20037508.342787, -20037508.342780, 20037508.342780, 20037508.342787, new SpatialReference({ wkid: 102100 })),
   tileInfo: new TileInfo({  
   rows: 256,  
   cols: 256,  
   dpi: 96,  
   format: "PNG8",  
   compressionQuality: 0,  
   origin: new Point({  
   x: -20037508.342787,  
   y: 20037508.342787,  
   spatialReference: new SpatialReference({ wkid: 102100 })
   }),
   spatialReference: new SpatialReference({ wkid: 102100 }),
   lods: [  
  new LOD({ level: 0, scale: 591657527.591555, resolution: 156543.033928 }),  
  new LOD({ level: 1, scale: 295828763.795777, resolution: 78271.5169639999 }),  
  new LOD({ level: 2, scale: 147914381.897889, resolution: 39135.7584820001 }),  
  new LOD({ level: 3, scale: 73957190.948944, resolution: 19567.8792409999 }),  
  new LOD({ level: 4, scale: 36978595.474472, resolution: 9783.93962049996 }),  
  new LOD({ level: 5, scale: 18489297.737236, resolution: 4891.96981024998 }),  
  new LOD({ level: 6, scale: 9244648.868618, resolution: 2445.98490512499 }),  
  new LOD({ level: 7, scale: 4622324.434309, resolution: 1222.99245256249 }),  
  new LOD({ level: 8, scale: 2311162.217155, resolution: 611.49622628138 }),  
  new LOD({ level: 9, scale: 1155581.108577, resolution: 305.748113140558 }),  
  new LOD({ level: 10, scale: 577790.554289, resolution: 152.874056570411 }),  
  new LOD({ level: 11, scale: 288895.277144, resolution: 76.4370282850732 }),  
  new LOD({ level: 12, scale: 144447.638572, resolution: 38.2185141425366 }),  
  new LOD({ level: 13, scale: 72223.819286, resolution: 19.1092570712683 }),  
  new LOD({ level: 14, scale: 36111.909643, resolution: 9.55462853563415 }),  
  new LOD({ level: 15, scale: 18055.954822, resolution: 4.77731426794937 }),  
  new LOD({ level: 16, scale: 9027.977411, resolution: 2.38865713397468 }),  
  new LOD({ level: 17, scale: 4513.988705, resolution: 1.19432856685505 }),  
  new LOD({ level: 18, scale: 2256.994353, resolution: 0.597164283559817 }),  
  new LOD({ level: 19, scale: 1128.497176, resolution: 0.298582141647617 })  
   ]  
   })  
   })  
  ]  
  })
})
0 Kudos
0 Replies