MapServer come proxy WMS con riproiezione
Il problema
Un server WMS fornisce una copertura secondo alcuni sistemi di riferimento. Vogliamo quei dati (sempre in WMS) ma con un SRS diverso.
La soluzione
Configurare MapServer per agire contemporaneamente come client e server WMS (proxy), effettuando la riproiezione al volo.
L'esempio
Il server originale fornisce la copertura in EPSG:32632, noi riproiettiamo in EPSG:3003. Questo mapfile per MapServer 5.6.0 configura un server WMS compatibile anche con QGIS 1.5.0, che è abbastanza pignolo con le extent dichiarate nel GetCapabilities.
Il server WMS offre la scelta tra EPSG:3003 (quello dichiarato a livello di MAP) e EPSG:32632 (quello nativo del layer). È possibile aggiungere altri layer, ciascuno con il proprio SRS.
MAP
NAME "wms_proxy"
PROJECTION
'init=epsg:3003'
END
EXTENT 1553047 4673137 1775018 4932778
UNITS meters
WEB
IMAGEPATH '../mapserv/tmp/'
METADATA
'wms_title' 'WMS Proxy'
'wms_srs' 'EPSG:3003'
END
END
IMAGETYPE png
OUTPUTFORMAT
# This is for WMS requests with "FORMAT=image/png"
NAME 'png'
DRIVER 'GD/PNG'
EXTENSION 'png'
IMAGEMODE RGB
FORMATOPTION 'INTERLACE=OFF'
END
OUTPUTFORMAT
# This is for WMS requests with "FORMAT=image/png; mode=24bit"
NAME 'png_agg'
DRIVER 'AGG/PNG'
EXTENSION 'png'
IMAGEMODE RGBA
TRANSPARENT ON
FORMATOPTION 'INTERLACE=OFF'
END
LAYER
NAME 'idrst10k'
TYPE RASTER
STATUS ON
CONNECTION 'http://web.rete.toscana.it:80/sgrwms/com.rt.wms.RTmap/_rt_wms_wgs84?'
CONNECTIONTYPE WMS
PROJECTION
"init=epsg:32632"
END
EXTENT 553045 4673053 775005 4932687
# EPSG:4326 EXTENT 9.642603853 42.2078509685 12.4589466172 44.4951035402
# EPSG:3003 EXTENT 1553047 4673137 1775018 4932778
METADATA
'wms_title' 'idrst10k'
'wms_abstract' 'idrst10k da Geoscopio'
'wms_srs' 'EPSG:32632'
'wms_extent' '553045 4673053 775005 4932687'
'wms_name' 'idrst10k'
'wms_server_version' '1.1.1'
'wms_format' 'image/png'
END
END
END
Nota
Lo standard WMS 1.3 pare ben supportato da MapServer 5.6.0, ma alcune sue caratteristiche (ad esempio quella di scambiare gli assi X e Y quando annuncia le extent nella GetCapabilities) potrebbero non essere ben supportate dai client.
