Hi All,

I am using OSM maps in my application and download tiles from tile https://tile.openstreetmap.org/. I am using WebClient to download the tile from OSM server. It is worked perfectly before 5 days. But suddenly, tiles not downloaded from server and maps not displayed in my application. I used below code to download tile.

imageBytes = await webClient.DownloadDataTaskAsync(imageUri);

I have checked the source and getting the below exception in try catch.

The remote server returned an error: (403) Forbidden.

To resolve this, i set the below properties as true but still maps not displayed in my application.

webClient.UseDefaultCredentials = true; webClient.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;

Any one please help me to resolve this issue.

Regards, Bharathi.

asked 16 Mar, 14:59

Bharathirajak's gravatar image

Bharathirajak
1612
accept rate: 0%

1

Can you estimate how many tiles you have downloaded in this way?

(16 Mar, 15:13) Frederik Ramm ♦

It is not working for first level itself. It has just 4 tiles

(16 Mar, 15:41) Bharathirajak
1

But you said it worked 5 days ago. How many tiles have you downloaded in this way in the last couple of months until it stopped working?

(16 Mar, 16:16) Frederik Ramm ♦

I think the problem is not related to downloading more tiles. Because the issue can be reproduced in simple sample itself by using the above code to download tiles. I have tested with simple sample and different machine and devices.

(16 Mar, 17:12) Bharathirajak
1

This issue particularly reproduced when using web client in Xamarin.Forms Android and iOS. In Forms.UWP, we directly used url to image source and it is working fine.

(17 Mar, 07:51) Bharathirajak

You are probably not following the tile usage policy found here: https://operations.osmfoundation.org/policies/tiles/

Esp. you'll need a User-Agent that is not generic but specific to your application and also adhere to the other Technical Usage Requirements (see policy document). You'll also have to follow the bulk downloading restrictions (not loading more than 250 tiles from zoom 13 or grater).

Best idea would be to use one of external tile providers if it is for a commercial application that needs reliability or - if that's not the case - try to follow the technical requirements from the usage policy. And Frederiks question is still valid: how many tiles has your app loaded already? If those numbers are too high, you may get blocked as well.

permanent link

answered 17 Mar, 08:35

Spiekerooger's gravatar image

Spiekerooger
1.4k1327
accept rate: 17%

Hi Spiekerooger,

Thanks for your update. But, it is reproduced in simple sample. Just downloaded a single tile statically in this. Please find the sample link.
https://github.com/bharathirajauk/MySamples/blob/master/Maps.zip

(17 Mar, 11:19) Bharathirajak
4

Sorry, but you did not answer any of the questions above. Again: your application got blocked in accessing tiles because it does not follow the tile usage policy. That's why you get a http 403 error. So: do you use a unique user-agent string? How many tile requests do you send on average and how many tile requests did you sent already?

And looking at your code: you are faking a generic user-agent. In doing so, you get blocked.

(17 Mar, 11:29) Spiekerooger

Thanks for your answer and confirm the problem is related to User-Agent that is not generic. I have created Xamarin mobile app to show the OSM map. I will request tile server for each pinch zooming on map based on the zooming level. I don’t know exactly how many requests given already; it is depending on application testing usage. Can you please let me know how to pass valid and generic user agent? it's related to the OSM usage policy.?

(17 Mar, 14:17) Bharathirajak
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×631
×319
×173
×22
×4

question asked: 16 Mar, 14:59

question was seen: 285 times

last updated: 17 Mar, 14:17

powered by OSQA