Android Question Open Street Map viewer example shows no map

grafsoft

Well-Known Member
Licensed User
Longtime User
Hi,

I am trying


the tiles show diagonal stripes but no map. I must be overlooking something ...
 
Solution
Thank you!

I am using the b4xmap example in https://www.b4x.com/android/forum/threads/open-street-map-viewer-gps.127827/.

I find the download server address and the User-Agent in the .java files, but nowhere in *.b4a or *.bas. Do you have an idea in which file I should put the changes?
see

TILogistic

Expert
Licensed User
Longtime User
see:

Change:
Otros Server Tiles_
openstreetmap
j.Download($"https://a.tile.openstreetmap.fr/osmfr/${aZ}/${aX}/${aY}.png"$)
Googlemaps
j.Download($"https://mt1.google.com/vt/lyrs=r&x=${aX}&y=${aY}&z=${aZ}"$)
B4X:
'Get Tile from internet openstreemap website
public Sub getTileFromInternet(aZ As Int,aX As Int,aY As Int) As ResumableSub
    Dim j As HttpJob
    Dim bmp As B4XBitmap
    Try
        j.Initialize("", Me)
'        j.Download($"https://a.tile.openstreetmap.org/${aZ}/${aX}/${aY}.png"$)
        j.Download($"https://a.tile.openstreetmap.fr/osmfr/${aZ}/${aX}/${aY}.png"$) 'Other server tiles
        j.GetRequest.SetHeader("User-Agent","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0") 'see user gent
        Wait For (j) JobDone(j As HttpJob)
        If j.Success Then
            Try
                bmp=j.GetBitmap
            Catch
                Log($"getTileFromInternet: ${LastException.Message}"$)
            End Try
        End If
    Catch
        Log($"getTileFromInternet: ${LastException.Message}"$)
    End Try
    If j.IsInitialized Then
        j.Release
    End If
    Return bmp
End Sub
 
Last edited:
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
Thank you!

I am using the b4xmap example in https://www.b4x.com/android/forum/threads/open-street-map-viewer-gps.127827/.

I find the download server address and the User-Agent in the .java files, but nowhere in *.b4a or *.bas. Do you have an idea in which file I should put the changes?
see
 
Upvote 1
Solution

grafsoft

Well-Known Member
Licensed User
Longtime User
Thank you! I did not understand that B4XMap is a ZIP-file! My mistake, of course, it is written in the comments.
 
Upvote 0
Top