Select to view content in your preferred language

WMS from Geoserver/GWC not displaying properly

373
0
03-18-2024 08:52 AM
JurajMurcko1
New Contributor II

I have WMS tiled service, (I guess it´s WMS-C from GeoWebCache(GWC) according to the url composition, and it´s also WMS-T with TIME dimension) at URL like this:
https://mapy.meteo.pl/geoserver/gwc/service/wms?

I am trying to display it in ArcGIS Maps SDK for JavaScript 4.29 (ArcGIS JS API 4) map app. I am using the WMSLayer class (esri/layers/WMSLayer):

const wmsLayer = new WMSLayer({


url: "https://mapy.meteo.pl/geoserver/gwc/service/wms?tiled=true",
sublayers: [{name: "um:UM1_CLOUD"}],
customLayerParameters: {
SERVICE: 'WMS',
REQUEST: 'GetMap',
VERSION: '1.1.0,
TRANSPARENT: true,
FORMAT: 'image/png',
// TIME: '2024-03-18T00:00:00Z',
// DIM_FORECAST: '13',
TILED: true,
WIDTH: 256,
HEIGHT: 256,
}


but the map doesn´t display the tiles and GeoServer/GWC request reurns an error: "400: Requested horizontal resolution: 1961.0875069406065 , best match: 2445.9849047851562 exceeds 10% threshold. Perhaps the client is configured with an incorrect set of scales (resolutions), or the DPI setting is off compared to the one in GWC ?"

The layer I am requesting is in EPSG:900913 (other CRS is not available on GWC for this layer), which should be the same as EPSG:3857 (but is it really?). ArcGIS JS API 4 doesn´t know CRS with WKID 900913 so if I need to declare the CRS, I use

spatialReference: { wkid: 3857 }

The same WMS tiled can be viewed without problem in Leaflet using L.tileLayer.wms class (confirmed by colleague) or in OpenLayers using TileWMS class (tested myself):

...
new TileLayer({
source: new TileWMS({
url: 'https://maps.meteo.pl/geoserver/gwc/service/wms',
params: {
'LAYERS': 'um:UM1_CLOUD',
'FORMAT': 'image/png',
'SERVICE': 'WMS',
'TRANSPARENT': true,
'VERSION': '1.1.1',
'REQUEST': 'GetMap',
'TIME': '2024-02-01T000000Z',
'TILED': true,
'DIM_FORECAST': '77',
'WIDTH' : 256,
'HEIGHT' : 256
}
}),
}),

and that works.

At one point I managed to get in ArcGIS JS API 4 one tile of 255*255 in upper-left corner, but it was always in the upper-left corner even when I moved the map and It was always only one tile, like in the image attached.


I need to display the whole extent of the layer. I also need to be able to access the TIME dimension of the WMS-T and DIM_FORECAST custom dimensions.

 

So the question is how to properly display this WMS service from GWC in ArcGIS JS API 4. How to construct the initiallization of the layer to view the entire image, should I use different layer class?  There are esri/layers/WebTileLayer and esri/layers/WMTSLayer, but it did not work, they seems to be meant for other type of source data - XYZ tiling schemes (WebTileLayer) or proper WMTS services (WMTSLayer). I tried almost all of them, it didn´t work.

Seems that WMSLayer is the one to use, but can it be also used with WMS tiled services/layers? Is it possible that ArcGIS JS API has a differnet tiling scheme (not sure what exactly it means) than the WMS layer, and it cannot display WMS in EPSG:900913.

 

I am attaching the full code here:
https://codepen.io/JuMu/pen/QWPdyvq

0 Kudos
0 Replies