3

I am using the WMS interface of GeoServer to retrieve raster data. The raw raster data is stored in an Oracle database,and based on the WMS BBOX parameter and height/width GeoServer decides which zoom level and resolution/pyramid level will be used - as far as I understand.

For my requirement I need to define a BBOX and as a result I want an image (e.g. GeoTIFF) with the highest possible resolution (like the resolution of the raw images in the database) returned. I don't care about the file size, height and width of the image.

Are there WMS parameters to accomplish that?

  • A WMS may not have an original raster image. WMS create images, the input may be purely vector data. – nmtoken Dec 1 '16 at 23:10
4

Why to assume if you can check the facts?

See the list of <wcscrs:crsSupported> from http://demo.opengeo.org/geoserver/wcs?service=WCS&version=2.0.1&request=GetCapabilities.

By looking at offsetVectors from http://demo.opengeo.org/geoserver/wcs?service=WCS&version=2.0.1&request=describecoverage&coverageid=nurc__Img_Sample you can get the native resolution. It is a bit hard to interpret even if you study WFS 2.0 standard https://portal.opengeospatial.org/files/09-110r4.

Fortunately you do not need to care about that because native resolution is the default. You must only select your region of interest with &subset= parameters

http://demo.opengeo.org/geoserver/wcs?service=WCS&version=2.0.1&request=getcoverage&coverageid=nurc__Img_Sample&subset=Lat%28%2220%22,%2230%22%29&subset=Long%28%22-100%22,%22-90%22%29

The end of the request without url-encoding:

&subset=Lat("20","30")&subset=Long("-100","-90")

Check what you get with gdalinfo:

gdalinfo nurc__Img_Sample.tif
Driver: GTiff/GeoTIFF
Files: nurc__Img_Sample.tif
Size is 142, 166
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (-99.965403825025433,29.979242474916386)
Pixel Size = (0.070036907426246,-0.055867725752508)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_RESOLUTIONUNIT=1 (unitless)
  TIFFTAG_XRESOLUTION=1
  TIFFTAG_YRESOLUTION=1
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  ( -99.9654038,  29.9792425) ( 99d57'55.45"W, 29d58'45.27"N)
Lower Left  ( -99.9654038,  20.7052000) ( 99d57'55.45"W, 20d42'18.72"N)
Upper Right ( -90.0201630,  29.9792425) ( 90d 1'12.59"W, 29d58'45.27"N)
Lower Right ( -90.0201630,  20.7052000) ( 90d 1'12.59"W, 20d42'18.72"N)
Center      ( -94.9927834,  25.3422212) ( 94d59'34.02"W, 25d20'32.00"N)
Band 1 Block=142x19 Type=Byte, ColorInterp=Red
  NoData Value=0
Band 2 Block=142x19 Type=Byte, ColorInterp=Green
  NoData Value=0
Band 3 Block=142x19 Type=Byte, ColorInterp=Blue
  NoData Value=0

Pixel size seems similar to offsetVectors so yes, we got the native resolution. Study the standard and you will learn how to get data in other projection but you can't really get the native resolution and warped image at the same time. You must select one or the other.

Hand writing WCS GetCoverage requests are not fun but at least then you know what will happen. I do not know how well this QGIS plugin works http://plugins.qgis.org/plugins/QgsWcsClient2/

2

The simple answer is no you can't do that with WMS. Fortunately the OGC are smart people who foresaw this need and so developed WCS so that people could download raster data.

Long answer: You need to create a getCoverage request for your coverage which looks a bit like this:

<sourceCoverage>training:panorama</sourceCoverage>
  <domainSubset>
    <spatialSubset>
      <gml:Envelope srsName="EPSG:27700">
        <gml:pos>-25.0 -25.0</gml:pos>
        <gml:pos>660025.0 1240025.0</gml:pos>
      </gml:Envelope>
      <gml:Grid dimension="2">
        <gml:limits>
          <gml:GridEnvelope>
            <gml:low>0 0</gml:low>
            <gml:high>13201 24801</gml:high>
          </gml:GridEnvelope>
        </gml:limits>
        <gml:axisName>E</gml:axisName>
        <gml:axisName>N</gml:axisName>
      </gml:Grid>
    </spatialSubset>
  </domainSubset>
  <output>
    <crs>EPSG:27700</crs>
    <format>GeoTIFF</format>
  </output>
</GetCoverage>

I generated that one using the GeoServer WCS coverage request builder (Look under demos) or you can make a describeCoverage request and write one by hand.

  • Thanks for the WCS hint. I just saw that my initial question was not correct, because I don't want to lose the ability of WMS to apply different projections and to align the pixels when I want to compare different layers. I asume WCS can't do that. What is the best way to find the right bbox and height/width parameters for WMS to get the raster data in the original resolution? – MikeHuber Nov 11 '15 at 15:47
  • No WMS just can't do all those things. – Ian Turton Nov 11 '15 at 16:05
  • If you want to play with WMS you can still read the native resolution with WCS DescribeCoverage and use your calculator for adjusting WIDTH, HEIGHT, and BBOX of GetMap so that they yield the desired pixel size. – user30184 Nov 11 '15 at 17:01
  • But be aware that many (all?) WMS will have restrictions on WIDTH and HEIGHT or possibly WIDTH*HEIGHT. – Ian Turton Nov 11 '15 at 17:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.