Ticket #3997 (closed enhancement: fixed)

Opened 2 years ago

Last modified 3 months ago

Field "Referer" required in WMS service description XML files

Reported by: jcrepetto Owned by: warmerdam
Priority: normal Milestone: 1.9.0
Component: GDAL_Raster Version: svn-trunk
Severity: normal Keywords:
Cc: nowakpl

Description

Some TMS servers require a special "Referer" in HTTP headers. For example,  http://map.geo.admin.ch/ .

The attached patch adds support for a "Referer" field to the WMS driver.

The patch contains a configuration file for this service, that you can test with the command :

gdal_translate -projwin 737440 275760 740000 273200 frmts/wms/frmt_wms_swissgeo_tms.xml test.tif

Attachments

gdal_referer.patch Download (3.7 KB) - added by jcrepetto 2 years ago.
Configuration file for Swiss Topo
three-digits.patch Download (2.9 KB) - added by jcrepetto 2 years ago.
Patch to split tile numbers into three groups of three digits

Change History

Changed 2 years ago by jcrepetto

Configuration file for Swiss Topo

Changed 2 years ago by rouault

  • cc nowakpl added
  • milestone changed from 1.8.1 to 1.9.0

r21966 /trunk/gdal/frmts/wms/ (7 files): WMS: add capability to set Referer http header; TMS-specific hack for some servers that require tile numbers to have exactly 3 characters (#3997)

While playing with the example file for Swiss topo, I have discovered the following issues I've noted in the xml file I've commited :

<!-- Caution : currently the georeferencing only works properly for the lowest-resolution level (base band). Some overviews levels are not exactly at half resolution of the neighbouring overview level, and the extent might also be slightly different... -->

Changed 2 years ago by jcrepetto

The "TMS-hack" you added is not correct. I suggest something like :

  URLSearchAndReplace(url, "${xxx}", "%03d/%03d/%03d", tiri.m_x / 1000000, (tiri.m_x / 1000) % 1000, tiri.m_x % 1000); 
  URLSearchAndReplace(url, "${yyy}", "%03d/%03d/%03d", tms_y / 1000000, (tms_y / 1000) % 1000, tms_y % 1000); 

My plan was to submit a patch to address this problem after the "referer" patch has been accepted, but you went too fast :-)

You are right about the overviews, only the first three ones are valid. I'll file another ticket for this problem.

Changed 2 years ago by rouault

Will you attach a patch for a more correct version of the TMS hack (and the adaptation of the XML) ? Thanks

Changed 2 years ago by jcrepetto

The tile numbers must be split in three groups of three digits (millions, thousands, units). I attach a patch to fix your previous patch. I have also updated the configuration file, you can use it at levels 20, 21 and 22 (2 overviews). Examples :

gdal_translate -projwin 549280 102960 590240 62000 frmt_wms_swissgeo_tms.xml level22.tif
gdal_translate -outsize 8192 8192 -projwin 549280 102960 590240 62000 frmt_wms_swissgeo_tms.xml level21.tif
gdal_translate -outsize 4096 4096 -projwin 549280 102960 590240 62000 frmt_wms_swissgeo_tms.xml level20.tif

Changed 2 years ago by jcrepetto

Patch to split tile numbers into three groups of three digits

Changed 2 years ago by rouault

  • status changed from new to closed
  • resolution set to fixed

three-digits.patch applied in r22021 with an extra warning in the .xml file

Changed 2 years ago by jcrepetto

The documentation page at  http://www.gdal.org/frmt_wms.html needs to be updated to describe the new variables ${xxx} and ${yyy}.

Changed 2 years ago by rouault

Yeah, but I'm not too sure that this hack is under its final form and really deserves publicity... Do you now if it is used by other servers than this swisstopo one ?

Adam also suggested on IRC that we should perhaps have a more general way of formatting the x and y with some form of expression evaluation, but this is a non-trivial thing to implement. And I'm not sure than his proposal of doing it with reversed polish notation would be the most intuitive way for the user ;-)

Changed 2 years ago by jcrepetto

I know these ones :  http://map.geoportail.lu/ (Luxembourg)  http://map.globe.admin.ch/ (Switzerland)

Changed 3 months ago by rouault

The example has been removed per #5022

Note: See TracTickets for help on using tickets.