-
-
Notifications
You must be signed in to change notification settings - Fork 402
Description
Software environment
- Mapserver 8.2.0
- Mapcache 1.14.0
- Gdal V3.8.4
- Alma Linux V8
Problem description
(see discussion on mapserver-users)
WMS Getmap responses depend on version V1.1.1 vs V1.3.0:
- SRS/CRS : epsg:4326,
- source data : GPKG, with InspireCRS84Quad tiling scheme.
For example:
- WMS V1.1.1 request:
https://xxx/layers/baselayers/wms?service=WMS&version=1.1.1&request=GetMap&Layers=osm_4326&Styles=&SRS=EPSG:4326&Format=image/png&BBOX=45,22.5,67.5,45&Width=1024&Height=1024
Labels are easy to read: mapcache/mapserver is selecting the right zoom level in the GPKG file.
- WMS V1.3.0 request:
https://xxx/layers/baselayers/wms?service=WMS&version=1.3.0&request=GetMap&Layers=osm_4326&Styles=&CRS=EPSG:4326&Format=image/png&BBOX=22.5,45,45,67.5&Width=1024&Height=1024
Labels are much too small and not readable. It seems that mapcache/mapserver is selecting a higher zoom level than expected and down-sample the image
Some explanations
(see https://www.mail-archive.com/mapserver-users@lists.osgeo.org/msg29229.html, thanks to @jratike80)
- WMS 1.1.0 is using method "msDrawRasterLayerGDAL()"
msDrawRasterLayerGDAL(): Entering transform.
msDrawRasterLayerGDAL(): src=0,0,4096,2048, dst=0,10,994,498
- WMS 1.3.0 probably believes that is must do warping and it selects to use
method "msDrawGDAL(Image_Layer)"
msResampleGDALToMap in effect: cellsize = 0.181087
msDrawGDAL(Image_Layer): using RAW_WINDOW=0 0 4096 2048, dst=0,0,1988,994
The Apache error log shows that depending on the WMS version, GDAL selects different overview levels from the GeoPackage, either "overview 1024 x 512" or "overview 2048 x 1024"
Workarounds
Adding some processing directives in the LAYER definition:
PROCESSING "OVERSAMPLE_RATIO=1.0"
An other option is to modify CRS value in the WMS/V1.3.0 request (instead of EPSG:4326):
CRS=CRS:84
How to reproduce
Here is the mapserver file:
MAP
NAME "Services_WMS"
STATUS ON
PROJECTION
'init=epsg:4326'
END
EXTENT -180.000000 -90.000000 180.000000 90.000000
MAXSIZE 1000
LAYER
NAME "Image_Layer"
STATUS ON
TYPE RASTER
DATA "osm_3_levels.gpkg"
PROJECTION
'init=epsg:4326'
END
# paramètres de connection
PROCESSING "CLOSE_CONNECTION=DEFER"
PROCESSING "GAMMA=0.5"
METADATA
"wms_name" "Image_Layer"
"wms_title" "Couche image"
"wms_abstract" "Affichage de la couche image"
END
END #LAYER
END
The GPKG file, containing OSM up to ZoomLevel=3 can be found on the following link:
https://drive.google.com/file/d/1XjduR5L6aoSRuKEKYb9hBNB07Gv7_-P2/view?usp=drivesdk