Hi
Seems there is a general problem regrading OSM-tiles and DevExpress.XtraMap.MapControl. Using Fiddler I can see that OSM is now returning a ERR_ACCESS_DENIED. If I request the tile in Chrome there is no problems.
Any workarounds?
Request:
HTMLGET http://c.tile.openstreetmap.org/4/7/5.png HTTP/1.1 Referer: http://www.openstreetmap.org/ Accept: image/* Host: c.tile.openstreetmap.org
Response:
HTMLHTTP/1.1 403 Forbidden
Server: squid/2.7.STABLE9
Date: Tue, 28 May 2019 14:05:35 GMT
Content-Type: text/html
Content-Length: 1207
X-Squid-Error: ERR_ACCESS_DENIED 0
X-Cache: MISS from rimfaxe.openstreetmap.org
X-Cache-Lookup: NONE from rimfaxe.openstreetmap.org:3128
Via: 1.0 rimfaxe.openstreetmap.org:3128 (squid/2.7.STABLE9)
Connection: close
ERROR: The requested URL could not be retrieved
<!--
%l
body
:lang(fa) { direction: rtl; font-size: 100%; font-family: Tahoma, Roya, sans-serif; float: right; }
:lang(he) { direction: rtl; }
-->
ERROR
The requested URL could not be retrieved
The following error was encountered while trying to retrieve the URL: http://tile.openstreetmap.org/4/7/5.png
Access Denied.
Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect.
Your cache administrator is webmaster@openstreetmap.org.
Generated Tue, 28 May 2019 14:05:35 GMT by rimfaxe.openstreetmap.org (squid/2.7.STABLE9)
Kind regards, Ole
Yeah I have same problem in my own application and checked demo.
It looks like only the OSM Basic Map type is affected. Other types like Transport do work.
Greetings,
Roland
Hi,
Our demo module uses the public OSM server ("http://{0}.tile.openstreetmap.org/{1}/{2}/{3}.png")) that has limited bandwidth and may be not accessible for this reason. We will examine if this issue relates to excessive requests from our application and check for a suitable solution. At the same time, you can use alternative tile providers (see Tile usage policy) by adjusting the TileUriTemplate property to avoid similar issues.
Hi Alex
Thanks for following-up . I do believe this is not a bandwidth problem. I'll guess that every end-user of DevExpress MapControl will be identified as the same application. Therefor OSM-tile-server is blocking all DevExpress-end-users. The MapControl has to be uniquely identified (for every app) in the tile-requests. Eg. in OSMdroid (OSM library for Android) you have to call setUserAgentValue to set this identifier.
I'll hold my breath until you have a solution.
With kind regards, Ole
Ole,
When you add an OSM data provider to MapControl in design mode, the TileUriTemplate is set to the following address:
http://{0}.tile.INSERT_SERVER_NAME.com/{1}/{2}/{3}.png
We cannot use the public OSM server name by default (tile.openstreetmap.org) because of the OpenStreetMaps Tile Usage Policy.
In any case, we will update this ticket once we have any news.
Hi,
OSM works through HTTPS protocol
Alex,
I found following code in OpenStreetMapTileSource sources
protected internal override string Referer
{
get
{
return "http://www.openstreetmap.org/";
}
}
And there’re many templates like "http://{0}.tile.openstreetmap.org/{1}/{2}/{3}.png" in OpenStreetMapDataProvider.
I think, it’s needs to use https instead of http.
Ole,
you can set "https://{0}.tile.openstreetmap.org/{1}/{2}/{3}.png" into TileUriTemplate property and
add following code:
tileLayer.DataProvider.WebRequest += DataProvider_WebRequest;
private void DataProvider_WebRequest(object sender, MapWebRequestEventArgs e)
{
e.Referer = "https://www.openstreetmap.org/";
}
OSM through MapControl will work fine.
Hi Sergey
You are absolutely a champ :)
I did try the https yesterday to no avail. But setting the e.Referer did the trick. However I do believe that it should be set to something uniquely for the individual app. Eg. "com.mycompany.appname".
Thanks a lot :)
Hi Sergey!
Great work thanks!
The solution works, but is very slow on my end.
And beware that this only needs te be done for Basic map type. Other types like Transport, will not work over https.
Following the proposed solution by Sergey and montioring the https traffic with Fiddler, I get:
HTTP/1.1 429 Too Many Requests
which leads again to no tiles being displayed …
Any ideas how to solve this?
Ok, I forgot to set the user-agent header together with the referer, so now fiddler shows a 200 status code.