[mapserver-users] Mapserver + WMS
Carl Godkin
cgodkin at gmail.com
Mon Oct 11 15:35:20 PDT 2021
Hi Jeff,
Thank you very much for the detailed response. When I run the commands you
provided, everything matches and the output GeoTIFF file definitely has the
type "Type=Int16."
I was originally asking why I didn't see that type when querying the server
with the sub-datasets returned by this command
> gdalinfo "WMS:http://localhost:8080//elev"
but I'm probably just coloring outside the lines of what WMS is meant to
support.
I think that the next thing I will do is use WCS for this instead. I
confess that I went with WMS since I'm more familiar with it. I expected a
single-band 16-bit "image" to act like a 2D grid which is what happens when
I import "BIL" files or other single-band images.
Thanks for stepping me through this and pointing me at WCS.
carl
On Mon, Oct 11, 2021 at 11:35 AM Jeff McKenna <jmckenna at gatewaygeomatics.com>
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
>
>
>
> --
> Jeff McKenna
> GatewayGeo: Developers of MS4W, MapServer Consulting and Training
> co-founder of FOSS4G
> http://gatewaygeo.com/
>
>
>
> On 2021-10-07 8:12 p.m., Carl Godkin wrote:
> > Hi,
> >
> > I'm new to mapserver but fairly experienced with GDAL. I hope that
> > someone can explain where I've gone wrong with setting up WMS.
> >
> > I followed the instructions here
> > [https://worldwind.earth/elevation-server.html
> > <https://worldwind.earth/elevation-server.html>] almost exactly to set
> > up a WMS server and it sort of works. (I am using MS4W actually, so I
> > didn't install Apache & Mapserver as that page described and of course I
> > made a few other adaptations for Windows.)
> >
> > I downloaded the GEBCO tiles from here
> > [https://www.gebco.net/data_and_products/gridded_bathymetry_data/
> > <https://www.gebco.net/data_and_products/gridded_bathymetry_data/>]
> > without any problems.
> >
> > What I don't understand is that while the GEBCO GeoTIFF files that I am
> > using have one band that gdalinfo describes as
> >
> > Band 1 Block=512x512 Type=Int16, ColorInterp=Gray
> >
> > when I look at the WMS bands using gdalinfo, I see three byte-sized
> bands:
> >
> > Band 1 Block=1024x1024 Type=Byte, ColorInterp=Red
> > Band 2 Block=1024x1024 Type=Byte, ColorInterp=Green
> > Band 3 Block=1024x1024 Type=Byte, ColorInterp=Blue
> >
> > I'd really like to get 16-bit integer elevations from my WMS server but
> > I don't know why this didn't just happen or how I mis-configured things
> > to make it not happen.
> >
> > I know these are not complete details, but rather than write a novel for
> > my first post here, I'm hoping someone can suggest where the problem
> > might be or suggest some further documentation to read.
> >
> > Thanks very much,
> > carl
> >
> >
> >
> _______________________________________________
> MapServer-users mailing list
> MapServer-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20211011/404d44b7/attachment.htm>
More information about the MapServer-users
mailing list