hi, i using WMSlayer to display radar data from Environment canada(https://www.canada.ca/en/environment-climate-change/services/weather-general-tools-resources/weather...)
it works fine. the code looks like below, but i have an issue to display only partial service map. right now it always give me the whole north america map. but i would like to just show the portion of ontario, i thought setting the extent would do it but it didn't seem to work, what should i do? any idea?
var layer1 = new WMSLayerInfo({name:"RADAR_1KM_RRAI",title:"RADAR - Radar reflectivity (Rain) (1 km) [dBZ]" });
var resourceInfo = {
extent: new Extent(map.xmin,map.ymin,map.xmax,map.ymax,{wkid: 4326}),
customParameters : {"TIME": "2019-07-24T13:50:00Z",
"UPPERCASE": true,
"STYLES": "RADARURPPRECIPR14",
"SLD_VERSION": "1.1.0",
"lang": "en",
"KEEPBUFFER": 2,
"ZINDEX": 8
},
queryable: true,
layerInfos: [layer1]
};
var lyr = new WMSLayer("https://geo.weather.gc.ca/geomet/",{resourceInfo:resourceInfo, visibleLayers: ["RADAR_1KM_RRAI"]});
lyr.spatialReferences[0] = 3857; //900913
lyr.setRefreshInterval(1)
map.addLayer(lyr);
Hi Yao Yu,
First you might want to check with getmap request with certain resolution and test that whether wms layer return the image correctly?
Second, it might be the bug in the existing wms layer object in js, because it seems to be getting the wms map image based on the screen size.
You might want to refer to this Custom layer - WMS | ArcGIS API for JavaScript 3.29 and create your own wms layer and control the getmap image size.