I am trying to load my first WMS Service into an ArcGIS API for JavaScript web app. To start I am testing the 'Florida Mosaic' demo service from LizardTech, browsable here:
http://demo.lizardtech.com/lizardtech/iserv/browse
This is my code to add the service:
wmsTest : new WMSLayer("http://demo.lizardtech.com/lizardtech/iserv/ows", {
resourceInfo: {
extent: new Extent(-82.908008,26.740052,-81.248255,29.572644, new SpatialReference({ wkid:4326 })), // must be in PCS of service
getMapURL: "http://demo.lizardtech.com/lizardtech/iserv/ows",
layerInfos: [
new WMSLayerInfo({
name: "Florida_Mosaic"
})
],
spatialReferences : [4326, 26917],
},
spatialReferences : [4326, 3857],
version : "1.1.1",
visibleLayers : ["Florida_Mosaic"]
})
I can see the HTTP Request sent to the demo site, and that their is an image download:
But when I zoom in to Florida, no imagery is displayed.
Some other posts have discussed the need for the service to be in Web Mercator, but the API documentation doesn't say that's required. Is that my issue? Other thoughts?
Thanks for any help/ideas!
Solved! Go to Solution.
Hi Sarah
This is how got the layer to load and display:
var resourceInfo = {
extent: new Extent(-180, -90, 180, 90, {
wkid: 4326
}),
layerInfos: [
new WMSLayerInfo({
name: 'Alaska_IFSAR',
title: 'Alaska_IFSAR'
}),
new WMSLayerInfo({
name: 'Colorado',
title: 'Colorado'
}),
new WMSLayerInfo({
name: 'Florida_Mosaic',
title: 'Florida_Mosaic'
})
]
};
wmsLayer = new WMSLayer('http://demo.lizardtech.com/lizardtech/iserv/ows', {
resourceInfo: resourceInfo,
visibleLayers: ['Florida_Mosaic']
});
wmsLayer.version = '1.1.1';
wmsLayer.spatialReferences[0] = 3857;
map.addLayer(wmsLayer);
It seems like the "version" parameter does not apply immediately during layer construction, but setting it afterwards solves it. The version is obviously important for the bbox parameter format and SRS (CRS for 1.3.0)
Hi Sarah
This is how got the layer to load and display:
var resourceInfo = {
extent: new Extent(-180, -90, 180, 90, {
wkid: 4326
}),
layerInfos: [
new WMSLayerInfo({
name: 'Alaska_IFSAR',
title: 'Alaska_IFSAR'
}),
new WMSLayerInfo({
name: 'Colorado',
title: 'Colorado'
}),
new WMSLayerInfo({
name: 'Florida_Mosaic',
title: 'Florida_Mosaic'
})
]
};
wmsLayer = new WMSLayer('http://demo.lizardtech.com/lizardtech/iserv/ows', {
resourceInfo: resourceInfo,
visibleLayers: ['Florida_Mosaic']
});
wmsLayer.version = '1.1.1';
wmsLayer.spatialReferences[0] = 3857;
map.addLayer(wmsLayer);
It seems like the "version" parameter does not apply immediately during layer construction, but setting it afterwards solves it. The version is obviously important for the bbox parameter format and SRS (CRS for 1.3.0)
Amazing! Thanks!