Android Tutorial OSMDroid - MapView for B4A tutorial

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

  1. Emerito

    Emerito Member Licensed User

    Gracias.
    Mi duda ahora es: ¿Tengo que solicitar una licencia personal o poniendo lo que me envía es suficiente?
    Disculpe mi torpeza.
    Saludos.

    Thank you.
    My question now is: do I have that request a licensed staff or putting what I send is enough?
    Excuse my stupidity.
    Best regards.
     
  2. warwound

    warwound Expert Licensed User

    To comply with the terms and conditions of the licenses just display the 2 licenses 'somewhere' in your app.
    So displaying the 2 licenses in a WebView means you're complying with the terms and conditions of the licenses.
    That's all you have to do.

    There's no need to contact anyone to get written or verbal permission.
     
  3. Emerito

    Emerito Member Licensed User

    Thank you.
    Best regards.
     
  4. GiovanniPolese

    GiovanniPolese Active Member Licensed User

    Hi to all.
    Warwound library is quite interesting and works well with online maps. Now, perhaps with a long delay, I am examining the tutorials, namely that on off-line maps. Probably I missed something, but using Mobac seems not aligned with the tutorial explanations. For example I don't find MapNik in the list of atlases. MapNik doen't exist at the indicated link. I did some "blind" trials using OSMDroid zip Atlas format, but the resulting file, despite being added to Files folder, is not added at compile time (b4a explicitly says "test.zip is not added to your project" in the log.. but the file is there). I did other trials, but, in such conditions it is a nonsense to go on. Can anybody tell me what I am missing? Thanks in advance.
     
  5. warwound

    warwound Expert Licensed User

    I wonder why that is...
    Is test.zip a very large file?
    Is it too big to be compiled into your apk?
    A quick Google suggests that an .apk file is limited to a maximum of 50MBs.
     
  6. GiovanniPolese

    GiovanniPolese Active Member Licensed User

    Hi. It should not be large. In fact I did just one 5° tile, at same resolutions of your example. I will redo the procedure, perhaps problems on my computer (to day i have strange very delayed answers on some win10 OS commands; some files seem to be in a folder (with b4a files folder sync) but they could have been erased, and Windows Waits minutes to answer). I will confirm this fact and, in case, put here the zip file. The project is exactly yours, with just the Center and the tile provider and filename string changed. Anyway, what about MapNik? To obtain the zip I used OSMDroid zip format. Is it correct? Moreover, you mention several strings for the tile providers.. I could be wrong, but none of them appears in the Mobac list of atlases. At least things are very obscure in this aspect. Thanks for your attention..
     
  7. GiovanniPolese

    GiovanniPolese Active Member Licensed User

    Hi. No, the problem of the file doesn't exist. It was due to something else. Now the app displays a white screen with a grid. This could be due to the map Center. I retrieved it from GoogleEarth, with decimal angles. A problem could be here and I must check. Forget about. Just give me, if possible, some hints on the maps providers listed by Mobac. Thanks.
     
  8. GiovanniPolese

    GiovanniPolese Active Member Licensed User

    Final test. Used Atlas for selecting a tile. (See Atlas.png). In the center there is the town of "Spresiano". Went to GoogleEarth to find the coordinates of Spresiano (see google_earth_position.png). Modified the basic example (see b4a_changes.png). Running the example, a tile near the south-east limits of England appears. Probably the center is not a problem, because the tile appears on top-left screen, as perhaps should be. I cannot attach the zip file which si slightly more than 1100 kb. Thanks anyway.
     

    Attached Files:

  9. BW17

    BW17 Member Licensed User

    Hi to all

    My app use OsmDroid 3.08 and works fine.
    But i wish use OsmDroid 4.01

    I use offline tile with XYTileSource in OsmDroid 3.08. as this :
    Code:
    Dim MyXYTileSource As XYTileSource

            MyXYTileSource.Initialize(
    "my_offline_tile"415256".png",  "http://localhost")
    myMap1.AddXYTileSource(MyXYTileSource)


    I'm looking for the same thing under 4.01 but can't find it.

    Could you help me please ?

    (sorry for my very bad english).
     
  10. MarcoRome

    MarcoRome Expert Licensed User

    Hi Worwound and thank you for your great work.
    Right now I have made a donation ( 88W96424XV693531T ).
    I have two questions.
    1) I found a lot example for OSM 3 but few for OSM 4.
    2) Is possibile a example about lines, polylines, etc.
    Thank you again for your great work
    Bye
    Marco
     
  11. warwound

    warwound Expert Licensed User

    @MarcoRome

    I have no examples for lines and polylines on this computer.
    Can you explain what you are trying to draw and i'll try to help.
     
  12. MarcoRome

    MarcoRome Expert Licensed User

    Hi Warwound and thank you for your time.
    Example this:

    Immagineosm.jpg


    Another question, do you have a few examples ( general ) that work in OSM Rel. 4 ?

    Thank you again.
    Regards
    Marco
     
  13. warwound

    warwound Expert Licensed User

    Look here for some version 4.1 examples: http://b4a.martinpearman.co.uk/osmdroid/
    • OSMDroid_4.1_CircleOverlay.zip
    • OSMDroid_4.1_UrlTileSource.zip
    • OSMDroid_v4.1_examples.zip

    I've just uploaded the CircleOverlay example - found it on this computer but have not re-tested it - i'm assuming it still works.

    Try those examples and let me know if you still need a polygon example.
    You might also wanna read through the version 4.1 reference page: http://b4a.martinpearman.co.uk/osmdroid/OSMDroid_4_1.html
     
    nemiroG1 and MarcoRome like this.
  14. sasidhar

    sasidhar Active Member Licensed User


    Hi,

    In designer I have added Customview and named it as MapView1, But customYpe I could not see anything, though i have added OSM library in reference.
    please let me know, which control I have to add. while loading layout it is giving error.

    Sub Activity_Create(FirstTime As Boolean)
    If File.ExternalWritable=False Then
    ' OSMDroid requires the use of external storage to cache tiles
    ' if no external storage is available then the MapView will display no tiles
    Log("WARNING NO EXTERNAL STORAGE AVAILABLE")
    End If

    ' no EventName is required as we don't need to listen for MapView events
    MapView1.Initialize("")
    Activity.LoadLayout("1")
    Activity.AddView(MapView1, 0, 0, 100%x, 100%y)

    ' by default the map will zoom in on a double tap and also be draggable - no other user interface features are enabled

    ' enable the built in zoom controller - the map can now be zoomed in and out
    MapView1.SetZoomEnabled(True)

    ' enable the built in multi touch controller - the map can now be 'pinch zoomed'
    MapView1.SetMultiTouchEnabled(True)

    ' set the zoom level BEFORE the center (otherwise unpredictable map center may be set)
    MapView1.Zoom=15
    MapView1.SetCenter(55.3286,25.2153)
    End Sub
     
  15. warwound

    warwound Expert Licensed User

    The OSMDroid MapView was never updated to be used in the Designer as a CustomView.
    A MapView can only be created and added to an Activity using code.
     
  16. MichalK73

    MichalK73 Active Member Licensed User

    Hello.

    How do I add or change other basic maps with OSM, is standardly Mapnik?
    In the same way whether it is possible to add overlays to the map. For example, I have an overlay ortophotomap Polish for my country and I would like it to impose on the base map.

    Example map from Poland
     
  17. StefanoAccorsi

    StefanoAccorsi Member Licensed User

    Hi. First of all thank you @warwound for this great library.

    I've got a question. I need to draw a circle overlay but with translucency. I read that it is possible to set an alpha value in a pathoverlay, but I didn't find the same method in circleoverlay or other overlays.

    I read a similar question from @MarcoRome up in this page but I didn't find anything useful in the examples. Thank you so much.
     
  18. Ydm

    Ydm Member Licensed User

    Did you Zoom Level maximum 11? Should I upgrade?

    MapView1.Initialize("MapView1")
    MapView1.SetZoomEnabled(True)
    MapView1.SetMultiTouchEnabled(True)
    MyLocationOverlay1.Initialize(MapView1, "MyLocationOverlay1")
    SimpleLocationOverlay1.Initialize(MapView1)
    MapCenter=MapView1.GetCenter

    Log(MapView1.GetMaxZoomLevel) >>>>>>>>>>>>>> 11
     
  19. Ydm

    Ydm Member Licensed User

    I wrote everything right application.
    This did not solve the problem of zoom. I looked at the examples 14-20 are using, such as zoom level. Bente maximum zoom 11.
    I would appreciate if you can help ...
     
  20. PCowling

    PCowling Member Licensed User

    Hello

    I have a question when using the 4.01 framework.

    I have written an app (well you have, I needed your code to help!!) This takes tiles from the Thunderforest tiles on their hobby license.

    I have limited the zoom so that the user can not zoom past level 13, however I would when this is hit allow the user to stretch in effect the tile. This is so that we do not zoom in any more (as this resizes and the names and map features) but so that they also become larger and allowing some spacial context to be kept on the screen.

    I have seen an demo you wrote where the comments said that this would happen when limiting the zoom level, however on mine it just stops pinch zooming. As does the demo when I compile and run that.

    Thanks to anyone with any help.

    Phil
     
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