How to add different WMS Layer to one map

2191
3
03-07-2012 12:45 AM
ManuelVinzek
New Contributor
Hi,

i have written a dynamical web viewer with an esri basemap (world_topo_map) with wkid:102100. now i have different wms layers with epsg:4326, epsg:3004 or epsg:3003 and so on. how can i show them all on a map with wkid:102100 generated with javascript api? the world_topo_map supports only 102100 (i think)

thx
0 Kudos
3 Replies
BetsySchenck-Gardner
Occasional Contributor
Here's how to add a WMS service of a different projection such as 4326 to a basemap (102110):
var layer1 = new esri.layers.WMSLayerInfo({name:"1",title:"Rivers"});
var resourceInfo = {
              extent: new esri.geometry.Extent(-126.40869140625,31.025390625,-109.66552734375,41.5283203125,{wkid: 4326}),
              layerInfos: [layer1]
            };
var lyr = new esri.layers.WMSLayer("http://sampleserver1.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServe...",
              {resourceInfo: resourceInfo,
              visibleLayers: ["1"]
            });
map.addLayer(lyr);

If you define the resourceInfo, you bypass the getCapabilities call that is executed when you use WMSLayer command ... this means you don't have to use a proxy page
0 Kudos
ManuelVinzek
New Contributor
Here's how to add a WMS service of a different projection such as 4326 to a basemap (102110):
var layer1 = new esri.layers.WMSLayerInfo({name:"1",title:"Rivers"});
var resourceInfo = {
              extent: new esri.geometry.Extent(-126.40869140625,31.025390625,-109.66552734375,41.5283203125,{wkid: 4326}),
              layerInfos: [layer1]
            };
var lyr = new esri.layers.WMSLayer("http://sampleserver1.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer",
              {resourceInfo: resourceInfo,
              visibleLayers: ["1"]
            });
map.addLayer(lyr);

If you define the resourceInfo, you bypass the getCapabilities call that is executed when you use WMSLayer command ... this means you don't have to use a proxy page



i tried this like the sample from esri and your code and it work's with the esri sample server. but with the wms is use i have still the same problem. it provides also an epsg:4326 but it fails to display a layer. i get always a "Resource interpreted as Image but transferred with MIME type text/xml:" message on the (chrome)console.

the wms i use is: http://gis.ktn.gv.at/wmsconnector/com.esri.wms.Esrimap/geoland_wms

could it be a wms (server) problem?
0 Kudos
ManuelVinzek
New Contributor
i think the problem must be the WMS. i tried the same code with different wms server. all of them served the layers als epsg:4326 to the basemap with epsg:102100 .
two of them war working fine (the esri testserver) two of them ar not working with this settings. but with a epsg:4326 basemap (esri_strretmap_wolrd_2d) they are working.

can somebody tell my why there are some differences? if the problem is located at the servers, this is also ok for me
0 Kudos