Opened 13 years ago
Closed 13 years ago
#3464 closed defect (fixed)
gdal_translate cannot download from WMS interface at geoportal.cuzk.cz
Reported by: | voland | Owned by: | nowakpl |
---|---|---|---|
Priority: | normal | Milestone: | 1.8.0 |
Component: | GDAL_Raster | Version: | unspecified |
Severity: | normal | Keywords: | WMS useragent |
Cc: | warmerdam |
Description (last modified by )
There is a WMS service in Czech Republic. It can be configured the following way:
<GDAL_WMS> <Service name="WMS"> <Version>1.3.0</Version> <ServerUrl>http://geoportal.cuzk.cz/wmsdata13/RASZM10/wms.asp?SID=&</ServerUrl> <CRS>EPSG:32633</CRS> <ImageFormat>image/png</ImageFormat> <Layers>GR_ZM10</Layers> </Service> <DataWindow> <UpperLeftX>540000</UpperLeftX> <LowerRightX>545000</LowerRightX> <LowerRightY>5608000</LowerRightY> <UpperLeftY>5614000</UpperLeftY> <SizeX>2500</SizeX> <SizeY>3000</SizeY> </DataWindow> <Cache> <Path>/cache</Path> <Depth>1</Depth> </Cache> <MaxConnections>1</MaxConnections> <BlockSizeX>500</BlockSizeX> <BlockSizeY>500</BlockSizeY> </GDAL_WMS>
It can be run with the following command:
gdal_translate -of ENVI wms.xml test.envi
The very first URL generated by gdal_translate cannot be downloaded:
Input file size is 2500, 3000 0ERROR 1: GDALWMS: Unable to download block 0, 0. URL: http://geoportal.cuzk.cz/wmsdata13/RASZM10/wms.asp?SID=&request=GetMap&version=1.3.0&layers=GR_ZM10&styles=&crs=EPSG:32633&format=image/png&width=500&height=500&bbox=540000.00000000,5613000.00000000,541000.00000000,5614000.00000000 HTTP status code: 200, error: (null). ERROR 1: IReadBlock failed at X offset 0, Y offset 0 ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 0
But if opened in Firefox, this URL is downloaded immediately.
It is possible that gdal_translate is missing something in HTTP Header like user agent, session ID or something that allows WMS server to check if it is a web browser or other piece of software.
Attachments (1)
Change History (7)
comment:1 by , 13 years ago
Cc: | added |
---|---|
Component: | default → GDAL_Raster |
Description: | modified (diff) |
Keywords: | WMS added |
Owner: | changed from | to
comment:2 by , 13 years ago
Voland, yes, your guess is right. That server expects the User-Agent field to be a well-known string, such as "Mozilla/5.0" whereas we currently fill it with "GDAL WMS driver (http://www.gdal.org/frmt_wms.html)".
Adam, I've attached a patch that provides a new <UserAgent> option to the GDAL WMS XML syntax. I'm not sure if it wouldn't be simpler to just default to "Mozilla/5.0" or some other common browser instead of the "GDAL WMS driver..." string ?
comment:4 by , 13 years ago
I don't think lying to the server is a good idea.
But it is not a criminal offense to let user decide what "User Agent" they want to use, especially in such rare cases like geoportal.cuzk.cz.
comment:5 by , 13 years ago
I see no harm in letting folks override the user agent, but I would not want the default to be "mozilla". I think the current described and distinct user agent string is the appropriate default.
comment:6 by , 13 years ago
Keywords: | useragent added |
---|---|
Milestone: | → 1.8.0 |
Resolution: | → fixed |
Status: | new → closed |
Adam,
Would you be interested in investigating this? If not, reassign back to me, and perhaps I can have Chaitanya look into it.