[gdal-dev] gdal_translate using a wms as input

Even Rouault even.rouault at mines-paris.org
Sun Apr 14 09:10:53 PDT 2013


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.


More information about the gdal-dev mailing list