[mapserver-users] MapServer CGI GDAL Raster reprojection

Heiko Schröter schroete at iup.physik.uni-bremen.de
Tue Oct 13 03:19:35 PDT 2009


Am Dienstag 13 Oktober 2009 11:50:13 schrieben Sie:

Hello,

sorry, no that doesn't work. I have tried with epsg:3575 (wich is somewhat polar and recognized by GDALWARP) but that fails as well.
Does anyone has a working example for reprojecting raster images via gdallib ?


Regards
Heiko



> Hi,
> 
> Perhaps it would work by making "+proj=ortho +lat_0=90" as the default projection of your map by adding MAP level PROJECTION block as:
> 
>   PROJECTION
>       "proj=ortho"
>       "lat_0=90"
>       "no_defs"
>   END 
> 
> If you want to get the image through WMS I suppose you should give it your own EPSG number and add corresponding line to epsg file, just like it has been done with EPSG:900913.
> 
> -Jukka Rahkonen-
> 
> > Heiko Schröter wrote:
> > 
> > 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&FOR
> MAT=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.
> > 



More information about the MapServer-users mailing list