<div dir="ltr">Hi Jeff,<div><br></div><div>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."</div><div><br></div><div>I was originally asking why I didn't see that type when querying the server with the sub-datasets returned by this command</div><div><br></div><div>> gdalinfo "WMS:<a href="http://localhost:8080//elev">http://localhost:8080//elev</a>"</div><div><br></div><div>but I'm probably just coloring outside the lines of what WMS is meant to support.  </div><div><br></div><div>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.</div><div><br></div><div>Thanks for stepping me through this and pointing me at WCS.</div><div><br></div><div>carl</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Oct 11, 2021 at 11:35 AM Jeff McKenna <<a href="mailto:jmckenna@gatewaygeomatics.com">jmckenna@gatewaygeomatics.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Carl,<br>
<br>
First, welcome to the MapServer community!<br>
<br>
Thanks for the detailed question, and pointing to the source data, this <br>
always helps to give a proper answer.<br>
<br>
You've done well and are very close.  Here are some points to consider:<br>
<br>
- the OGC specification for serving raw raster data is actually WCS <br>
(which MapServer does well, see <a href="https://mapserver.org/ogc/wcs_server.html" rel="noreferrer" target="_blank">https://mapserver.org/ogc/wcs_server.html</a> )<br>
<br>
- but you're right that a cool trick is to use the (more) popular WMS <br>
specification and set an OUTPUTFORMAT in your server's mapfile, to <br>
generate a GeoTIFF through a WMS GetMap request.<br>
<br>
- I see that you've already setup an OUTPUTFORMAT such as:<br>
<br>
OUTPUTFORMAT<br>
   NAME "GEOTIFF_16"<br>
   DRIVER "GDAL/GTiff"<br>
   MIMETYPE "image/tiff"<br>
   IMAGEMODE INT16<br>
   EXTENSION "tif"<br>
END<br>
<br>
- now the trick is to call that specific outputformat.  I recommend <br>
always testing this at the commandline first, with shp2img (which will <br>
be renamed to 'map2img' shortly, for the MapServer 8.0 release).  It <br>
takes a mapfile and generates an output (or gives exact error).<br>
<br>
- since you are using MS4W, just open a CMD window and cd into /ms4w. <br>
Then execute 'setenv.bat' to set necessary paths.  Then, in that same <br>
windows, cd to where your mapfile is, and execute the following (notice <br>
the "-i" switch, which requests the named outputformat set in the mapfile) :<br>
<br>
   shp2img -m local.map -o ttt16.tif -map_debug 3 -i GEOTIFF_16<br>
<br>
- that command should return a draw speed for each layer, and generate <br>
your 16-bit GeoTIFF.  And look closely at that response, the first words <br>
will be something like:<br>
<br>
    rendering using outputformat named GEOTIFF_16 (GDAL/GTiff)<br>
<br>
Great! That's what we want.<br>
<br>
- once you're satisfied, now we can turn to WMS requests.  But always <br>
first start with removing any "WARNING" messages in your GetCapabilities <br>
request, and then also verifying that the <Format> section of that <br>
response includes a listed "image/tiff" format option.  (example <br>
GetCapabilities request) :<br>
<br>
<br>
<a href="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" rel="noreferrer" target="_blank">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</a><br>
<br>
- once you're happy with the GetCapabilities response, then you can try <br>
a GetMap request, that includes "&FORMAT=image/tiff"<br>
<br>
<br>
<br>
<a href="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" rel="noreferrer" target="_blank">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</a><br>
<br>
- or you can stay right there at your commandline, and make that GetMap <br>
request there with the "mapserv -nh QUERY_STRING="" trick, and pipe that <br>
to a new image file, such as:<br>
<br>
   mapserv -nh <br>
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" <br>
 > getmap.tif<br>
<br>
Hope that helps.<br>
<br>
Also thanks for the positive feedback on MS4W, its goal is to serve big <br>
data fast for organizations, on enterprise Windows servers, and it <br>
sounds like it has met your needs well.  Look for a big MS4W release soon ;)<br>
<br>
And a happy (Canadian) Thanksgiving holiday to you.<br>
<br>
-jeff<br>
<br>
<br>
<br>
-- <br>
Jeff McKenna<br>
GatewayGeo: Developers of MS4W, MapServer Consulting and Training<br>
co-founder of FOSS4G<br>
<a href="http://gatewaygeo.com/" rel="noreferrer" target="_blank">http://gatewaygeo.com/</a><br>
<br>
<br>
<br>
On 2021-10-07 8:12 p.m., Carl Godkin wrote:<br>
> Hi,<br>
> <br>
> I'm new to mapserver but fairly experienced with GDAL.  I hope that <br>
> someone can explain where I've gone wrong with setting up WMS.<br>
> <br>
> I followed the instructions here <br>
> [<a href="https://worldwind.earth/elevation-server.html" rel="noreferrer" target="_blank">https://worldwind.earth/elevation-server.html</a> <br>
> <<a href="https://worldwind.earth/elevation-server.html" rel="noreferrer" target="_blank">https://worldwind.earth/elevation-server.html</a>>] almost exactly to set <br>
> up a WMS server and it sort of works.  (I am using MS4W actually, so I <br>
> didn't install Apache & Mapserver as that page described and of course I <br>
> made a few other adaptations for Windows.)<br>
> <br>
> I downloaded the GEBCO tiles from here <br>
> [<a href="https://www.gebco.net/data_and_products/gridded_bathymetry_data/" rel="noreferrer" target="_blank">https://www.gebco.net/data_and_products/gridded_bathymetry_data/</a> <br>
> <<a href="https://www.gebco.net/data_and_products/gridded_bathymetry_data/" rel="noreferrer" target="_blank">https://www.gebco.net/data_and_products/gridded_bathymetry_data/</a>>] <br>
> without any problems.<br>
> <br>
> What I don't understand is that while the GEBCO GeoTIFF files that I am <br>
> using have one band that gdalinfo describes as<br>
> <br>
>   Band 1 Block=512x512 Type=Int16, ColorInterp=Gray<br>
> <br>
> when I look at the WMS bands using gdalinfo, I see three byte-sized bands:<br>
> <br>
> Band 1 Block=1024x1024 Type=Byte, ColorInterp=Red<br>
> Band 2 Block=1024x1024 Type=Byte, ColorInterp=Green<br>
> Band 3 Block=1024x1024 Type=Byte, ColorInterp=Blue<br>
> <br>
> I'd really like to get 16-bit integer elevations from my WMS server but <br>
> I don't know why this didn't just happen or how I mis-configured things <br>
> to make it not happen.<br>
> <br>
> I know these are not complete details, but rather than write a novel for <br>
> my first post here, I'm hoping someone can suggest where the problem <br>
> might be or suggest some further documentation to read.<br>
> <br>
> Thanks very much,<br>
> carl<br>
> <br>
> <br>
> <br>
_______________________________________________<br>
MapServer-users mailing list<br>
<a href="mailto:MapServer-users@lists.osgeo.org" target="_blank">MapServer-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
</blockquote></div>