Select to view content in your preferred language

Using WMS as BasemapLayer for BasemapGallery - possible?

4714
2
01-27-2014 12:53 PM
RebeccaStrauch__GISP
MVP Emeritus
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();
2 Replies
RebeccaStrauch__GISP
MVP Emeritus
I wasn't able to add an UPDATE to the above so....(just in case someone else is wondering):

Short answer....WMS layers are not valid for a basemap in the BaseMapGallery dijit in JS API, at least at this time (I tried v3.8, which is the latest).

my comment.....funny that they work with AGOL basemap gallery and the Flex basemapgallery widget.  My guess is it is an enhancement that is not yet built into the JS API....but I admittedly have no idea what it would take to allow them to be used int he dijit, or if it's even possible.
0 Kudos
JeffPace
MVP Alum
Agree right now it is not supported but really needs to be


<String> type
The type of layer, valid values are "BingMapsAerial", "BingMapsHybrid", "BingMapsRoad", "OpenStreetMap", or "WebTiledLayer". Must specify either the url or type parameter except for WebTiledLayers where url and type is required.

<String> url
URL to the ArcGIS Server REST resource that represents a map or image service. Must specify either the url or type parameter.


WMS and WTMS need to be added valid types.
0 Kudos