[gdal-dev] Experiences with the WMS driver

Joaquim Manuel Freire Luís jluis at ualg.pt
Sat Jan 1 10:47:38 PST 2022


Hello and Happy New Year

I started playing (learning) with the WMS driver and wrote a couple of Julia functions to use it that work well ... some times.
If I use the "http://tiles.maps.eox.at/wms?" service I can get images from there but it already starts to feel strange the image resolution reported

But when I try one example used by the Matlab docs, http://svs.gsfc.nasa.gov/cgi-bin/wms? Then nothing works

First list the layers
gdalinfo http://svs.gsfc.nasa.gov/cgi-bin/wms?

Then try to download one

gdal_translate -of PNG "WMS:http://svs.gsfc.nasa.gov/cgi-bin/wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&LAYERS=3170_21483_bg&CRS=CRS:84&BBOX=-180.0,-90.0,180.0,90.0&TRANSPARENT=FALSE" -outsize 2048 512 out.png
Input file size is 1073741824, 536870912
ERROR 1: GDALWMS: The server returned exception code 'InvalidSize': WIDTH is invalid for layer. Should be 922.

ERROR 1: GDALWMS: The server returned exception code 'InvalidSize': HEIGHT is invalid for layer.  Should be 461.

ERROR 1: GDALWMS: The server returned exception code 'InvalidFormat': FORMAT is invalid for layer.  Should be image/png.

ERROR 1: GDALWMS: The server returned exception code 'InvalidBBOX': BBOX is invalid for layer.  Should be [-180,-90,180,90]

ERROR 1: GDALWMS: The server returned exception code 'LayerNotDefined': Unable to find layer.

ERROR 1: IReadBlock failed at X offset 0, Y offset 0: GDALWMS: The server returned exception code 'LayerNotDefined': Unable to find layer.


But if I do

gdalinfo "WMS:http://svs.gsfc.nasa.gov/cgi-bin/wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&LAYERS=3170_21483_bg&CRS=CRS:84&BBOX=-180.0,-90.0,180.0,90.0&TRANSPARENT=FALSE"

it seems to work but note the reported sizes and unreasonable resolution.

Data axis to CRS axis mapping: 1,2
Origin = (-180.000000000000000,90.000000000000000)
Pixel Size = (0.000000335276127,-0.000000335276127)
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (-180.0000000,  90.0000000) (180d 0' 0.00"W, 90d 0' 0.00"N)
Lower Left  (-180.0000000, -90.0000000) (180d 0' 0.00"W, 90d 0' 0.00"S)
Upper Right ( 180.0000000,  90.0000000) (180d 0' 0.00"E, 90d 0' 0.00"N)
Lower Right ( 180.0000000, -90.0000000) (180d 0' 0.00"E, 90d 0' 0.00"S)
Center      (   0.0000000,   0.0000000) (  0d 0' 0.01"E,  0d 0' 0.01"N)
Band 1 Block=1024x1024 Type=Byte, ColorInterp=Red
  Overviews: 536870912x268435456, 268435456x134217728, 134217728x67108864, 67108864x33554432, 33554432x16777216, 16777216x8388608, 8388608x4194304, 4194304x2097152, 2097152x1048576, 1048576x524288, 524288x262144, 262144x131072, 131072x65536, 65536x32768, 32768x16384, 16384x8192, 8192x4096, 4096x2048, 2048x1024, 1024x512


Debuggin in Matlab I could recover this request URL

http://svs.gsfc.nasa.gov/cgi-bin/wms?SERVICE=WMS&LAYERS=3140_21200&CRS=CRS:84&FORMAT=image/png&TRANSPARENT=FALSE&HEIGHT=512&BGCOLOR=&REQUEST=GetMap&WIDTH=2048&BBOX=-50.2,69.11,-49.6,69.26&STYLES=&VERSION=1.3.0

that works if we past it into a browser, but

trying it with gdal_translate errors again,  and again those huge image sizes

gdal_translate -of PNG "WMS:http://svs.gsfc.nasa.gov/cgi-bin/wms?SERVICE=WMS&LAYERS=3140_21200&CRS=CRS:84&FORMAT=image/png&TRANSPARENT=FALSE&HEIGHT=512&BGCOLOR=&REQUEST=GetMap&WIDTH=2048&BBOX=-50.2,69.11,-49.6,69.26&STYLES=&VERSION=1.3.0" out.png
Input file size is 1073741824, 268435456
ERROR 1: libpng: Read Error
ERROR 1: libpng: Read Error
Warning 1: libpng: Image width exceeds user limit in IHDR
Warning 1: libpng: Image height exceeds user limit in IHDR
ERROR 1: libpng: Invalid IHDR data


Joaquim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220101/df37efd0/attachment.html>


More information about the gdal-dev mailing list