[gdal-dev] gdal_translate using a wms as input

Signell, Richard rsignell at usgs.gov
Wed Aug 21 03:47:50 PDT 2013


I too am interested in trying to use gdal_translate with a WMS getmap
request, but using the approach suggested does not seem to preserve
the geospatial info:

rsignell at gam:~$ export GDAL_SKIP=WMS

rsignell at gam:~$ gdal_translate -of GTiff -co "TFW=YES"
"http://geoport.whoi.edu/

thredds/wms/bathy/gom15?LAYERS=topo&ELEVATION=0&TIME=2013-08-21T06%3A26%3A50Z&TR


ANSPARENT=true&STYLES=boxfill%2Frainbow&CRS=EPSG%3A4326&COLORSCALERANGE=-50%2C50


&NUMCOLORBANDS=64&LOGSCALE=false&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPT


IONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fpng&SRS=EPSG%3A4326&BBOX=-7


3.75,37.5,-69.5,41.75&WIDTH=256&HEIGHT=256" foo2.tif

Warning 6: A dataset opened by GDALOpenShared should have the same
filename (htt

p://geoport.whoi.edu/thredds/wms/bathy/gom15?LAYERS=topo&ELEVATION=0&TIME=2013-0


8-21T06%3A26%3A50Z&TRANSPARENT=true&STYLES=boxfill%2Frainbow&CRS=EPSG%3A4326&COL


ORSCALERANGE=-250%2C50&NUMCOLORBANDS=64&LOGSCALE=false&SERVICE=WMS&VERSION=1.1.1&


REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fpng&SR


S=EPSG%3A4326&BBOX=-73.75,37.5,-69.5,41.75&WIDTH=256&HEIGHT=256) and
description

(/vsimem/http_1/file.dat)
Input file size is 256, 256
0...10...20...30...40...50...60...70...80...90...100 - done.

rsignell at gam:~$ gdalinfo foo2.tif

Driver: GTiff/GeoTIFF
Files: foo2.tif
Size is 256, 256
Coordinate System is `'
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  256.0)
Upper Right (  256.0,    0.0)
Lower Right (  256.0,  256.0)
Center      (  128.0,  128.0)
Band 1 Block=256x32 Type=Byte, ColorInterp=Palette
  NoData Value=0


The only approach that I got working was passing the WMS request
params to gdal_translate again as shown here:

http://gis.stackexchange.com/questions/69188/converting-wms-getmap-request-to-geotiff

Thanks,
Rich


On Sun, Apr 14, 2013 at 12:10 PM, Even Rouault
<even.rouault at mines-paris.org> wrote:
> Le dimanche 14 avril 2013 13:17:30, Andrea Peri a écrit :
>> Even, thx for response
>>
>> Perhaps I miss the real mean of the parameter -srcwin.
>>
>> I guess that setting -srcwin 0 0 377 283 for a wms image of
>> ...WIDTH=377&HEIGHT=283&...
>
> Ah, I didn't notice those parameters. Well, they will be ignored by the GDAL
> WMS driver. You can check by looking at gdalinfo :
>
> $ gdalinfo
> "WMS:http://www502.regione.toscana.it/cartografia/wmsraster/com.rt.wms.RTmap/wms?map=wmsofc&language=ita&&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=1671200.0,4680000.0,1672800.0,4681200.0&CRS=EPSG:3003&WIDTH=377&HEIGHT=283&LAYERS=rt_ofc.10k10&STYLES=&FORMAT=image/jpeg&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi:96&TRANSPARENT=TRUE"
> Driver: WMS/OGC Web Map Service
> Files: none associated
> Size is 1073741824, 805306368
>
> Actually, as your string is a full WMS GetMap request, you can directly do
> this :
>
> export GDAL_SKIP=WMS
> gdal_translate -of GTiff -co "TFW=YES" "http://...." output_01J31.tif
>
> Note the removal of "WMS:" prefix in front of the URL, and the GDAL_SKIP=WMS,
> since the WMS driver would also try to recognize the string as a description
> string of the WMS service, which you don't want. You just want the JPEG driver
> to recognize the image resulting of the GetMap query.
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev



-- 
Dr. Richard P. Signell   (508) 457-2229
USGS, 384 Woods Hole Rd.
Woods Hole, MA 02543-1598


More information about the gdal-dev mailing list