rastrauch

Using WMS as BasemapLayer for BasemapGallery - possible?

Discussion created by rastrauch Champion on Jan 27, 2014
Latest reply on Jan 30, 2014 by jeff.pace
I am trying to use the Javascript API Base Map Gallery dijit  to display my tiled services in WKID 3338 (Alaska Albers) and would like to add two layers that are WMS services.  However, I'm not sure how to how to specify the spatial reference 3338 for the WMS services --- or, it may be that it isn't really seing the WMS at all.

Test site:  http://gis.adfg.alaska.gov/temp/widget_basemapList.html
The two marked GINA are the WMS services.

Previously, I was able to add the WMS layers in Flex using the wiget that is modifyable within the Flex Viewer Builder App and the main difference I see between the two is that in Flex <layer > has a "type=",      where  "esri/dijit/BasemapLayer" does not have a "type:" and instead seems to want the url.  My best guess is the basemap gallery dijit is not putting the WMS services in the correct Spatial Reference and/or extent.

I have the option to use our ArcGIS Online account if I can get it to work together in a group online.  I had the code working access a custom (basemap) group from our enterprise arcgis account, but haven't worked the spatial reference issue out there either for the WMS.....so open for suggestions.

BTW - Javascript API 3.8,  and using AMD module/structure.   Thanks...

partial code is below....

function createBasemapGallery() {
 //manually create ADFG Alaska Albers basemap gallery
 var basemaps = [];
 
 var USAtopo = new BasemapLayer ({ 
  url:"http://gis.adfg.alaska.gov/mapping/rest/services/dfg_public/USAtopoArcOnline/MapServer"
  });
 var USAtopoBasemap = new Basemap ({
  layers: [USAtopo], title: "USA topo (AK Albers)", thumbnailUrl: "assets/images/usatopo.PNG"
 });
 basemapGallery.add(USAtopoBasemap);

 var imagery2 = new BasemapLayer ({ 
  url:"http://gis.adfg.alaska.gov/mapping/rest/services/dfg_public/ginaImagery2/MapServer"
  });
 var imageryBasemap = new Basemap ({
  layers: [imagery2], title: "Imagery (AK Albers)", thumbnailUrl: "assets/images/ginaimagery.PNG"
 });
 basemapGallery.add(imageryBasemap);
 
              // .... 
             //   WMS layers to add.....

 var GINAbdl = new BasemapLayer ({ 
  url:"http://wms.alaskamapped.org/bdl",
  visiblelayers:"bdl_low_res,bdl_low_full,bdl_low_overview,bdl_mid_res,bdl_mid_res_overview,bdl_mid_res_full,bdl_high_res,bdl_high_res_full,bdl_high_res_overview"
  }); 
 var GINAbdlBasemap = new Basemap ({
  layers: [GINAbdl], title: "GINA BDL", thumbnailUrl: "assets/images/ginaimagery.PNG"
 });
 basemapGallery.add(GINAbdlBasemap);
 
 var GINAcharts = new BasemapLayer ({ 
  url:"http://wms.alaskamapped.org/charts",
  //type: "wms",
  visiblelayers:"Charts,noaa_chart_1000,noaa_chart_485,noaa_chart_350,noaa_chart_210,noaa_chart_155,noaa_chart_150,noaa_chart_140,noaa_chart_120,noaa_chart_110,noaa_chart_100,noaa_chart_95,noaa_chart_85,noaa_chart_80,noaa_chart_70,noaa_chart_50,noaa_chart_40,noaa_chart_35,noaa_chart_30,noaa_chart_20,noaa_chart_15,noaa_chart_10,noaa_chart_5,noaa_chart_1,noaa_chart_0"
  });  
 var GINAchartsBasemap = new Basemap ({
  layers: [GINAcharts], title: "GINA NOAA Charts", thumbnailUrl: "assets/images/NOAAcharts.PNG"
 });
 basemapGallery.add(GINAchartsBasemap);  
 

}

createBasemapGallery();

Outcomes