[mapserver-users] MapServer CGI GDAL Raster reprojection

Heiko Schröter schroete at iup.physik.uni-bremen.de
Tue Oct 13 01:42:16 PDT 2009


Hi,

is there a small howto recipe of how to reproject Raster Images via MapServer (CGI call) with the Gdal Lib ?
I need to go from EPSG:4326 to "+proj=ortho +lat_0=90" (Polar View) and i cannot figure out how to pass the Projection.
The output image stays in EPSG:4326.
This is not a proj4 issue. WMS calls for vector maps to be reprojected are ok (in a different scenario).

Any pointer to some infos or sample code are highly appreciated.

Thanks and Regards
Heiko
----------------------------------------------------------------------------------------------

Reprojecting with gdalwarp works fine:
gdalwarp -of GTiff -s_srs "epsg:4326" -t_srs "+proj=ortho +lat_0=90" -wo SOURCE_EXTRA=50 wmap_work.png wmap_out.png

/usr/lib/cgi-bin/mapserv -v
MapServer version 5.4.0-rc1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=THREADS INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE

The Test mapfile:
MAP
    NAME WELT
    CONFIG "MS_ERRORFILE" "/tmp/ms_raster_error.txt"
    DEBUG 5
    STATUS ON
    SIZE 800 400
    IMAGETYPE PNG24
    IMAGECOLOR 240 240 240
    SHAPEPATH "data"
    EXTENT -180 -90 180 90
    UNITS DD
    WEB
      IMAGEPATH "images"
      IMAGEURL "images"
      MINSCALE 50000
      MAXSCALE 400000000
      METADATA
#        "wms_title" "Example WMS Server"
#        "wms_onlineresource"  "http://kahlo1/cgi-bin/mapserv?map=heiko5.map&"
        "wms_srs" "ortho epsg:4326 epsg:900913"
#                  or 'proj=ortho' doesn't matter
      END
    END

    LAYER
      NAME "Bild"
      DATA "/home/schroete/sciadaten/raster_test/wmap_work.png"
      TYPE RASTER
      STATUS ON
      PROJECTION
        "proj=ortho"
      END
    END
END

The MapServer Test call:
/usr/lib/cgi-bin/mapserv -nh 'QUERY_STRING=MAP=/home/schroete/sciadaten/raster_test/raster.map&LAYERS=Bild&TRANSPARENT=true&SERVICE=WMS&VERSION=1.1.1&FORMAT=image/png&SRS=ortho&mode=map' > out.png


Debug output:
[Tue Oct 13 10:29:35 2009].656759 msDrawRasterLayerLow(Bild): entering.
[Tue Oct 13 10:29:35 2009].845281 msDrawMap(): Layer 0 (Bild), 0.189s
[Tue Oct 13 10:29:35 2009].845376 msDrawMap(): Drawing Label Cache, 0.000s
[Tue Oct 13 10:29:35 2009].845397 msDrawMap() total time: 0.193s
[Tue Oct 13 10:29:35 2009].958674 msSaveImage() total time: 0.113s
[Tue Oct 13 10:29:35 2009].958837 mapserv request processing time (loadmap not incl.): 0.307s
[Tue Oct 13 10:29:35 2009].958856 msFreeMap(): freeing map at 0x1729dc0.




-- 
-----------------------------------------------------------------------
!!! NEUE TELEPHONNUMMER !!!
!!! NEW PHONE NUMBER !!!

Dipl.-Ing. Heiko Schröter
Institute of Environmental Physics (IUP)    phone: ++49-(0)421-218-62092
Institute of Remote Sensing (IFE)           fax:   ++49-(0)421-218-4555
University of Bremen (FB1)
P.O. Box 330440               email:  schroete at iup.physik.uni-bremen.de
Otto-Hahn-Allee 1           
28359 Bremen                
Germany
-----------------------------------------------------------------------



More information about the MapServer-users mailing list