geos icon indicating copy to clipboard operation
geos copied to clipboard

Support additional HTTP headers for tiles.

Open grst opened this issue 8 years ago • 4 comments

e.g. strava heatmap and outdooractive block requests from google earth. This can be circumvented.

grst avatar Jul 26 '17 09:07 grst

Hi @grst Any timeline for supporting extra headers ? I would need to be able to add User-agent and Referer. I'm using such trick in MoBAC (using bsh) and LocusMapPro and it's very efficient to make some servers to work. Thanks

barbudor avatar Jun 27 '20 18:06 barbudor

Hi again @grst I looked in it to make a PR. I think I'm ok with reading a new tag extraHeader into the MapLayer class from the XML. Using syntax similar as LocusMap:

<extraHeader><![CDATA[User-Agent#Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36]]></extraHeader>
<extraHeader><![CDATA[Referer#https://www.geoportail.gouv.fr/carte]]></extraHeader>

But I can't seem to understand where the web request is performed to add those headers Any hint to help me ? Thanks

barbudor avatar Jun 27 '20 19:06 barbudor

Hi @barbudor,

I currently don't have time to actively maintain this project -- therefore, there are no timelines. But I'll gladly help you to make a PR.

I'm afraid it's a little more complicated. Web requests are made from different places, and only one is made directly from python:

  • By Google Earth. The Link stored in the KML is generated here and here. You would need to find out how to pass the headers via KML.
  • By GEOS for map printing: https://github.com/grst/geos/blob/15134a33af6c31689dde1f491424d8c32617aa04/geos/print.py#L106
  • By openlayers to display the web map: JSON object containing map info and displaying the map layers.

If you are only interested in one part, I would also merge a PR ignoring the other parts, as it's at least a start for this feature.

Cheers, Gregor

grst avatar Jun 28 '20 07:06 grst

Hi Gregor

Many thanks. I think it's going to take a little time for me to find my way. I'll let you know

Best regards

barbudor

barbudor avatar Jun 29 '20 18:06 barbudor