Android Tutorial OSMDroid - MapView for B4A tutorial

Discussion in 'Tutorials & Examples' started by warwound, Mar 26, 2012.

  1. Emerito

    Emerito Member Licensed User

    warwound, para hacer una donación pulso en cualquier botón "DONATE" ?
     
  2. warwound

    warwound Expert Licensed User

    Click below in my signature!
    Thanks.
     
    DonManfred likes this.
  3. Emerito

    Emerito Member Licensed User

    Fact.

    I am working in Windows 7. Is there any problem if I upgrade to Windows 10?

    Again, thank you.
     
  4. warwound

    warwound Expert Licensed User


    Hmm..
    Is this question related to the OSMDroid library?

    b4a should work the same regardless of the version of Windows you use.
    Though with older versions of Windows it might be necessary to update your .NET library so that the b4a IDE works properly.
     
  5. Emerito

    Emerito Member Licensed User

    I'm working on Windows 7 without any problem.
    Now offer me the update to Windows 10 and I would, if I upgrade, trouble with B4A, when I'm in the middle of a job!.
    As I use the Microsoft translator, not be if I explain clearly enough.
    A greeting
     
  6. warwound

    warwound Expert Licensed User

    Well in theory there should be no problem if you upgrade from Windows 7 to Windows 10.
    But if you are in the middle of a job i'd certainly complete the current job and then upgrade.
     
  7. Emerito

    Emerito Member Licensed User

    Thanks.
     
  8. Emerito

    Emerito Member Licensed User

    Hi Martin

    After clicking on a button (ic_...) ImageButtonsView, I can not return to click on it.
    It is disabled. Not resolved it.
     
  9. Emerito

    Emerito Member Licensed User

    Hi Martin

    I am sorry to insist. Could you help me?

    Francisco
     
  10. warwound

    warwound Expert Licensed User

    Hi.

    I'm not sure what to suggest.
    Without seeing your code it's impossible to help.

    Can you post a b4a project that shows the problem - i'll compile it and try to debug the issue.

    Martin.
     
  11. Emerito

    Emerito Member Licensed User

    FIX.

    Thank you Martin, was a silly bug in my code, wore False instead of True

    Greetings.
     
  12. Jean Pierre MALOBERTI

    Jean Pierre MALOBERTI Member Licensed User

    Hi all

    I'm testing B4A and OSMDroid and I'm impressed by your work guys !
    Unfortunately, I'm trying to run some code from version 3.08 in version 4.1 with the same data (a simple ZIP from jpg tiles).

    The 308 code was :
    Code:
    Sub Activity_Create(FirstTime As Boolean)
        
    Activity.LoadLayout("fond")
       
        ts.Initialize(
    "extrait2"1214500".jpg""http://localhost/")
        ts.TMSMode = 
    False
        Carto.Initialize(
    "")
        Carto.SetDataConnectionEnabled(
    False)
        Carto.AddXYTileSource(ts)
        Carto.SetTileSource(
    "extrait2")
        Carto.SetZoomEnabled(
    True)
        Carto.SetMultiTouchEnabled(
    True)
        
    If FirstTime Then
            Starter.MapCenter.Initialize(-
    21.005,55.280)
            Starter.ZoomLevel=
    12
            CompassEnabled = MaPosition.CompassEnabled
            FollowLocationEnabled = MaPosition.FollowLocationEnabled
            MyLocationEnabled = MaPosition.MyLocationEnabled
        
    Else
            MaPosition.CompassEnabled = CompassEnabled
            MaPosition.FollowLocationEnabled = FollowLocationEnabled
            MaPosition.MyLocationEnabled = MyLocationEnabled
        
    End If
        Carto.Zoom = Starter.ZoomLevel
           Carto.SetCenter3(Starter.MapCenter)

        PanCarte.AddView(Carto, 
    00100%x100%y)
    End Sub
    All is ok.

    The 4.1 code is :
    Code:
    Sub Activity_Create(FirstTime As Boolean)
        
    Activity.LoadLayout("fond")
       
        Carto.Initialize(
    "")
        Carto.SetUseDataConnection(
    True)
       
        
    Dim tsName As String = "extrait2"
        
    Dim TileSourceFactory1 As OSMDroid_TileSourceFactory
       
        
    If Not(TileSourceFactory1.ContainsTileSource(tsName)) Then
            
    Dim MyTileSource As OSMDroid_UrlTileSource
            MyTileSource.Initialize(Carto, tsName, 
    "http://localhost/%3$d/%1$d/%2$d.jpg"1214500)
            TileSourceFactory1.AddTileSource(MyTileSource)
        
    End If
        Carto.SetTileSource(TileSourceFactory1.GetTileSource(
    "extrait2"))
       
        Carto.SetBuiltInZoomControls(
    True)
        Carto.SetMultiTouchControls(
    True)
        
    If FirstTime Then
            Starter.MapCenter.Initialize(-
    21.005,55.280)
            Starter.ZoomLevel=
    17
        
    End If
        Carto.GetController.SetZoom(Starter.ZoomLevel)
           Carto.GetController.SetCenter(Starter.MapCenter)

        PanCarte.AddView(Carto, 
    00100%x100%y)
    End Sub
    The tiles are no more displayed. What's wrong ?
    The mImageFilenameEnding attribute is not initialized. Is it a problem ?

    Thanks
     
  13. Jean Pierre MALOBERTI

    Jean Pierre MALOBERTI Member Licensed User

    Solved (?)

    The code works again with a mbtiles database and is much faster !
    Strange.
     
  14. PCowling

    PCowling Member Licensed User

    Hi

    I have been having a play with the examples here, about half way through the day the map tiles stopped showing on the emulator. I have not changed any code. I thought there was an unlimited tile call for OSM?

    I have downloaded and tried fresh projects, emulators and tried different tile sources, so think I have eliminated all the possible options.

    Any help or advice would be great thanks.
     
  15. warwound

    warwound Expert Licensed User

    The free to use tileservers have a habit of suddenly failing to serve any tiles.
    They are generally funded by donations, and have limited resources.
    They can become overloaded at any time and then simply fail to respond to requests for tiles.

    The solution is to find another tileserver, one that is not so overloaded - that's unlikely to happen as other free tileservers will probably be overloaded too.

    You could try the offline map example and use MOBAC to render your own offline tile archive:
    http://www.b4x.com/android/forum/threads/mobac-supports-mapsforge-for-offline-tiles.53277/
     
  16. PCowling

    PCowling Member Licensed User

    Thanks, its working again now.

    Ill try that as Im trying to use the outdoors map - http://www.thunderforest.com/maps/outdoors/
    It gives a link to use the tiles, but I'm still looking around to sort this out.

    Thanks

    Phil
     
  17. Emerito

    Emerito Member Licensed User

    Hi Martin,

    The application I am doing uses the OSMDROID library. Make Tracks and set Waypoints.
    They could tell me:
    That kind of license do I need.
    How to apply for it.
    Thank you.
     
  18. warwound

    warwound Expert Licensed User

    @Emerito

    You want to handle the licenses for both: OSMDroid java library and the map tiles you use in your app.

    OSMDroid java library is licensed under the Apache License 2.0.
    See 'Code license' on the above link, left hand of page.

    The license for the tiles you use in your app depends entirely upon which tileserver you use.
    The default tileservers used by OSMDroid (Open Street Map based tileservers) license their tiles under the Creative Commons 3.0 BY-SA license.
    See 'Content license' on the above lin, just under 'Code license'.
     
  19. Emerito

    Emerito Member Licensed User

    Excuse my stupidity. I'm having trouble interpreting the translation.
    I understand that you attaching the downloaded document in
    http://www.apache.org/licenses/LICENSE-2.0 ( TXT or HTML )
    adding my data, is it enough? i.e., the license is granted?
    In any case. Which would be the B4A tool to show the license?
    You beg once more that I apologise.
    Thanks

    Could I send you the apk to see it?
     
  20. warwound

    warwound Expert Licensed User

    @Emerito

    I'd suggest you add a new Activity to your project - an 'About' or 'Credits' Activity.
    In the new Activity add a WebView and use the WebView to display something like:

     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice