[mapserver-users] Mapserver + WMS

Jeff McKenna jmckenna at gatewaygeomatics.com
Mon Oct 11 11:47:12 PDT 2021


Hi Carl,

Also, as you travel down this path, please aim to adding your upcoming 
elevation WMS service into the MapServer Site Gallery : 
https://github.com/MapServer/MapServer/wiki/MapServer-Site-Gallery

This really helps new users see the powers of MapServer.

Thanks!

-jeff



-- 
Jeff McKenna
GatewayGeo: Developers of MS4W, MapServer Consulting and Training
co-founder of FOSS4G
http://gatewaygeo.com/


On 2021-10-11 3:35 p.m., Jeff McKenna wrote:
> Hi Carl,
> 
> First, welcome to the MapServer community!
> 
> Thanks for the detailed question, and pointing to the source data, this 
> always helps to give a proper answer.
> 
> You've done well and are very close.  Here are some points to consider:
> 
> - the OGC specification for serving raw raster data is actually WCS 
> (which MapServer does well, see https://mapserver.org/ogc/wcs_server.html )
> 
> - but you're right that a cool trick is to use the (more) popular WMS 
> specification and set an OUTPUTFORMAT in your server's mapfile, to 
> generate a GeoTIFF through a WMS GetMap request.
> 
> - I see that you've already setup an OUTPUTFORMAT such as:
> 
> OUTPUTFORMAT
>    NAME "GEOTIFF_16"
>    DRIVER "GDAL/GTiff"
>    MIMETYPE "image/tiff"
>    IMAGEMODE INT16
>    EXTENSION "tif"
> END
> 
> - now the trick is to call that specific outputformat.  I recommend 
> always testing this at the commandline first, with shp2img (which will 
> be renamed to 'map2img' shortly, for the MapServer 8.0 release).  It 
> takes a mapfile and generates an output (or gives exact error).
> 
> - since you are using MS4W, just open a CMD window and cd into /ms4w. 
> Then execute 'setenv.bat' to set necessary paths.  Then, in that same 
> windows, cd to where your mapfile is, and execute the following (notice 
> the "-i" switch, which requests the named outputformat set in the 
> mapfile) :
> 
>    shp2img -m local.map -o ttt16.tif -map_debug 3 -i GEOTIFF_16
> 
> - that command should return a draw speed for each layer, and generate 
> your 16-bit GeoTIFF.  And look closely at that response, the first words 
> will be something like:
> 
>     rendering using outputformat named GEOTIFF_16 (GDAL/GTiff)
> 
> Great! That's what we want.
> 
> - once you're satisfied, now we can turn to WMS requests.  But always 
> first start with removing any "WARNING" messages in your GetCapabilities 
> request, and then also verifying that the <Format> section of that 
> response includes a listed "image/tiff" format option.  (example 
> GetCapabilities request) :
> 
> 
> http://127.0.0.1/cgi-bin/mapserv.exe?map=/ms4w/apps/ticket-wms-gebco-outputformat/local.map&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities 
> 
> 
> - once you're happy with the GetCapabilities response, then you can try 
> a GetMap request, that includes "&FORMAT=image/tiff"
> 
> 
> 
> http://127.0.0.1/cgi-bin/mapserv.exe?map=/ms4w/apps/ticket-wms-gebco-outputformat/local.map&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=-90,-180,90,180&CRS=EPSG:4326&WIDTH=346&HEIGHT=173&LAYERS=gebco&STYLES=&FORMAT=image/tiff&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi:96&TRANSPARENT=TRUE 
> 
> 
> - or you can stay right there at your commandline, and make that GetMap 
> request there with the "mapserv -nh QUERY_STRING="" trick, and pipe that 
> to a new image file, such as:
> 
>    mapserv -nh 
> QUERY_STRING="map=/ms4w/apps/ticket-wms-gebco-outputformat/local.map&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=-90,-180,90,180&CRS=EPSG:4326&WIDTH=346&HEIGHT=173&LAYERS=gebco&STYLES=&FORMAT=image/tiff&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi:96&TRANSPARENT=TRUE" 
>  > getmap.tif
> 
> Hope that helps.
> 
> Also thanks for the positive feedback on MS4W, its goal is to serve big 
> data fast for organizations, on enterprise Windows servers, and it 
> sounds like it has met your needs well.  Look for a big MS4W release 
> soon ;)
> 
> And a happy (Canadian) Thanksgiving holiday to you.
> 
> -jeff
> 
> 
> 



More information about the MapServer-users mailing list