Android Question Open Street Maps not working


Active Member
Licensed User
hello I use the B4XMap library but open street map shows me an error how to correct this?



Licensed User
Which particular part at: was not clear? Your first thought should be: which of those minimum requirements might I have tripped over?

OpenStreetMap’s own servers are run entirely on donated resources. They have strictly limited capacity. Heavy use of OSM tiles adversely affects people’s ability to edit the map, and is an abuse of the individual donations and sponsorship which provide hardware and bandwidth. As a result, we require that users of the tiles abide by this tile usage policy.

OpenStreetMap data is free for everyone to use. Our tile servers are not.

Below are the minimum requirements that users of must adhere to.
These may change in future, depending on available resources. Should any users or patterns of usage nevertheless cause problems to the service, access may still be blocked without prior notice. We will try to contact relevant parties if possible, but cannot guarantee this.

Because OpenStreetMap data is free, many other organisations provide map tiles made from OSM data. If your project doesn’t meet our requirements, you can get OSM-derived map tiles elsewhere.

Use of any OSMF provided service is further governed by the OSMF Terms of Use.


  • Heavy use (e.g. distributing a heavy-usage app that uses tiles from is forbidden without prior permission from the Operations Working Group. See below for alternatives.
  • Clearly display license attribution.
  • Do not actively or passively encourage copyright infringement.
  • Recommended: Do not hardcode any URL to as doing so will limit your ability to react if the service is disrupted or blocked. In particular, switching should be possible without requiring a software update.
  • Recommended: add a link to to allow your users to report and fix problems in our data.

Technical Usage Requirements​

  • Valid HTTP User-Agent identifying application. Faking another app’s User-Agent WILL get you blocked. Using a library’s default User-Agent is NOT recommended. If a device automatically sends an X-Requested-With header with an application specific Application ID, this will be considered an acceptable substitute for the HTTP User-Agent, although we still recommend setting a valid HTTP User-Agent for the application.
  • When coming from a web page, a valid HTTP Referer. Apps generally do not have a HTTP referer.
  • DO NOT send no-cache headers. (“Cache-Control: no-cache”, “Pragma: no-cache” etc.)
  • Cache Tile downloads locally according to HTTP Expiry Header, alternatively a minimum of 7 days.
  • Maximum of 2 download connections. (Unmodified web browsers’ download limits are acceptable.)
Note: modern web browsers in standard configuration generally pass all the above technical requirements.

Bulk Downloading​

Bulk downloading is strongly discouraged. Do not download tiles unnecessarily.

In particular, downloading an area of over 250 tiles at zoom level 13 or higher for offline or later usage is forbidden. These tiles are generally not available (cached) on the server in advance, and have to be rendered specifically for those requests, putting an unjustified burden on the available resources.

Alternative OpenStreetMap Tile Providers​

Tile servers based on OSM data:

Paid-for tile servers:

Setting up your own tile server:

Last edited:
Upvote 0

Serge Bertet

Active Member
Licensed User
Usually it is a matter of user-agent, the one in the library is not working, it must be changed.
public Sub getTileFromInternet(aZ As Int,aX As Int,aY As Int) As ResumableSub
    Dim j As HttpJob
    Dim bmp As B4XBitmap
    Dim t As String = aZ & "/" & aX & "/" & aY & ".png"
    j.Initialize("", Me)
    j.Download("" & t)
    j.GetRequest.SetHeader("User-Agent", "Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.102011-10-16 20:23:10")
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        bmp = j.GetBitmap
    end if
    return bmp
End Sub
This is what I use, I extracted the class from the library to be able to modify easily .
Upvote 0