[gdal-dev] Experiences with the WMS driver

Joaquim Manuel Freire Luís jluis at ualg.pt
Wed Jan 5 07:16:59 PST 2022


Tanks again Momtchil. Your example works indeed ... but not with my layer

curl 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 --output raw.png

the output is an html file saying

<p>The document has moved <a href=https://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>here</a>.</p>
</body></html>

Anyway, the curl solution is of little interest for me because I don't know how to programmatically select it instead of using gdal_translate.

From: Momtchil Momtchev <momtchil at momtchev.com>
Sent: Wednesday, January 5, 2022 12:18 AM
To: Joaquim Manuel Freire Luís <jluis at ualg.pt>; gdal-dev at lists.osgeo.org
Subject: Re: [gdal-dev] Experiences with the WMS driver




    You can get the raw image with curl (it is just a static image):

$ curl "https://svs.gsfc.nasa.gov/cgi-bin/wms?SERVICE=WMS&request=GetMap&version=1.3.0&layers=3170_21483_bg&styles=&format=image/png&bbox=-180,-90,180,90&crs=CRS:84&transparent=FALSE&width=922&height=461"<https://svs.gsfc.nasa.gov/cgi-bin/wms?SERVICE=WMS&request=GetMap&version=1.3.0&layers=3170_21483_bg&styles=&format=image/png&bbox=-180,-90,180,90&crs=CRS:84&transparent=FALSE&width=922&height=461>  --output raw.png

    Then use gdal_translate to georeference it:

$ gdal_translate -a_srs CRS:84  -a_ullr -180 90 180 -90 raw.png out.png


On 03/01/2022 21:15, Joaquim Manuel Freire Luís wrote:
Thanks. That's right that modifying the host name prints the same size info but there is nothing in the url that permits to estimate the "Pixel Size".

Also, this not the main issue. The main one is when passing a valid "GetMap" string that works in a browser but errors in gdal_translate.


From: Momtchil Momtchev <momtchil at momtchev.com><mailto:momtchil at momtchev.com>
Sent: Monday, January 3, 2022 3:08 PM
To: gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>; Joaquim Manuel Freire Luís <jluis at ualg.pt><mailto:jluis at ualg.pt>
Subject: Re: [gdal-dev] Experiences with the WMS driver




    gdalinfo does not contact the remote server at all, it extracts all the information it displays from the URL.

    Try replacing the hostname with something invalid, keeping all the parameters and you will still get the same output.




On 01/01/2022 19:47, Joaquim Manuel Freire Luís wrote:


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



--

Momtchil Momtchev <momtchil at momtchev.com><mailto:momtchil at momtchev.com>

--

Momtchil Momtchev <momtchil at momtchev.com><mailto:momtchil at momtchev.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220105/79d726d5/attachment-0001.html>


More information about the gdal-dev mailing list