You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have had problems problems downloading map tiles from the OpenStreetMap tile server. I got a 429 (Too many requests). That can be solved by adding a UserAgent header to the Http requests. I changed the following:
public HttpTileProvider(IRequest request = null, IPersistentCache<byte[]> persistentCache = null,
Func<Uri, byte[]> fetchTile = null)
{
//Add the UserAgent to the request so OpenStreetMap can track usage (and abuse)
_httpClient.DefaultRequestHeaders.UserAgent.ParseAdd("APP NAME GOES HERE");
_request = request ?? new NullRequest();
PersistentCache = persistentCache ?? new NullCache();
_fetchTile = fetchTile ?? FetchTile;
}
I have confirmed this to solve my issue on Android, where the map tiles were not downloaded, resulting in a white map. However, not sure if this is the right approach. Could you please have a look at it to see if this needs to be added to the BruTile library?
Your help is much appreciated.
The text was updated successfully, but these errors were encountered:
This problem started to affect me yesterday 30-May-2019. I agree with nijsf with a need to make this enhancement. In the short-term, I am looking to make the following change in fork:
Add an optional parameter added: string appName=null to:
KnownTileSources.Create(...)
HttpTileSource constructors
HttpTileProvider constructor
Applying modifying the defaultrequestheaders only if a value is provided.
if (!String.IsNullOrWhiteSpace(appName)) _httpClient.DefaultRequestHeaders.UserAgent.ParseAdd(appName);
Hello @pauldendulk,
I have had problems problems downloading map tiles from the OpenStreetMap tile server. I got a 429 (Too many requests). That can be solved by adding a UserAgent header to the Http requests. I changed the following:
I have confirmed this to solve my issue on Android, where the map tiles were not downloaded, resulting in a white map. However, not sure if this is the right approach. Could you please have a look at it to see if this needs to be added to the BruTile library?
Your help is much appreciated.
The text was updated successfully, but these errors were encountered: