VS: [mapserver-users] MapServer CGI GDAL Raster reprojection

Heiko Schröter schroete at iup.physik.uni-bremen.de
Tue Oct 13 06:43:43 EDT 2009


Am Dienstag 13 Oktober 2009 12:30:32 schrieben Sie:

Hello,

the mapfile i've tested looks similar to your setup. I'am just trying to strip out everything which is not needed.
But still it gets stuck in the EPSG:4326 projection.

From strace i can see that libgdal is touched but the search fails for '/usr/lib/gdal16plugins' (if that is important).
 
Regards
Heiko

Call:
/usr/lib/cgi-bin/mapserv -nh 'QUERY_STRING=MAP=/home/schroete/sciadaten/raster_test/raster.map&LAYERS=Bild&SRS=epsg:3575&mode=map' > out.png

Mapfile:
MAP
      PROJECTION # Does not make any diff here
        "init=epsg:3575"
      END

    WEB
      METADATA
        "wms_title" "Raster Test"
        "wms_onlineresource"  "http://kahlo1/cgi-bin/mapserv?map=/home/schroete/sciadaten/raster_test/raster.map&"
        "wms_srs" "epsg:3575 epsg:4326"
      END
    END

    LAYER
      NAME "Bild"
      DATA "/home/schroete/sciadaten/raster_test/wmap_work.png"
      TYPE RASTER
      STATUS ON
#      PROJECTION # Comment or not won't change a thing
#       "init=epsg:3575"
#    END
    END
END


> Hi
> 
> The projection of your Bild layer is
>  PROJECTION
>         "proj=ortho"
>  END 
> 
> I am not familiar with ortho projection, but are you sure that this is enough?  In your gdalwarp example you are using also "lat_0=90".
> There is no difference in reprojecting raster or vector data. This is a working example of one orthophoto layer:
>  METADATA
>    "wms_title"    "orthophotos 92-96"
>    "wms_srs" "EPSG:2393 EPSG:3067  EPSG:4326 EPSG:900913"
>  END
>  PROJECTION
>    "init=epsg:2393" 
>  END
> 
> -Jukka-
> 
> 
> Heiko Schröter wrote:
> 
> 
> > 
> > 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