B4A Library OSMDroid 6

The time has finally come to release a new version of the OSMDroid library that is based on the original version 6.1.15 from GitHub. This new version is completely new and is not based on an upgrade of the previous version found in this forum. The new version works on new versions of Android because it places the cache files in a location allocated by the system, and not in external memory like the previous one. Of course, in addition to that, it is much improved and supports a larger number of online map providers.

In addition to standard tile source providers such as MAPNIK, WIKIMEDIA, PUBLIC TRANSPORT, etc. also supports BingMaps, HereWeGo, MapBox, MapQuest and ThunderForest (all of these require a free or paid API key).

The main object of this library is the MapView which can be added via the designer. All other objects are added to the existing MapView as Overlays (Marker, Polygon, Polyline, Compass, etc.). Also a very important object is a static class module called OSMDroid6Configuration through which you can set the basic parameters of the library.

In addition to standard multiline coding, this library enables single line coding like some more advanced programming languages. For this, the OSMDroid6 static class module is used where you can find constructors like NewMarker, NewPolyline, NewPolygon, NewBingMapTileSource and constructors for all objects in the library. Of course, it's up to you to decide which programming method works best for you (I personally prefer a combination of both methods).

Multi line programming:
Dim mMarker As Marker
mMarker.Initialize(MapView1)
mMarker.SetPosition2(45,21)
mMarker.SetIcon2(LoadBitmap(File.DirAssets,"DrivingModeMarker.png"))
mMarker.SetDraggable(True)

Single line programming:
Dim mMarker As Marker = OSMDroid6.NewMarker(MapView1).SetPosition2(45,21).SetIcon2(LoadBitmap(File.DirAssets,"DrivingModeMarker.png")).SetDraggable(True)

The library contains a large number of static class modules that allow easier access to certain methods and constants. For these classes, it is not necessary to define and initialize a variable, but they behave like B4X modules.

Due to the limitation in the size of the file that can be uploaded, the rar archive is divided into several files that need to be unzipped with the help of WinRar. Unrar all the files from the archive to the Additional library folder. Also, the OSMD6_Doc archive file is attached.

There are no examples or tutorials attached because the library is large and compact and its functions are impossible to fit into a few short examples. For all necessary tutorials, post in this thread. Of course, try to figure out the basics from the shaded Doc file. Anyone who has used GoogleMaps or previous versions of OSMDroid should have no problem using this library because it is based on a similar principle.

Small example added!!! To run example you must download OSMDroid6BonusPack library.

If this libraries makes your work easier and saves time in creating your application, please make a donation.
 

Attachments

  • OSMD6_Docs.zip
    20.2 KB · Views: 374
  • OSMDroid6.part1.rar
    499 KB · Views: 416
  • OSMDroid6.part2.rar
    464.5 KB · Views: 376
  • Example.zip
    11.1 KB · Views: 253
Last edited:

papajds

Member
Good morning,

I'm trying to use OSMdroid6, and the bonus pack 6
the map is displayed correctly, but I am facing a small problem:
with each click on Zoom + or -, I have a marker created on the map
I searched, but I didn't find
have you ever noticed this problem?
THANKS
 

Attachments

  • OSMDroidExample.zip
    11.6 KB · Views: 147
  • osmdroid_map.jpg
    osmdroid_map.jpg
    204.8 KB · Views: 155

piro54

New Member
Licensed User
Longtime User
Too bad the "OSMDroid6.part1.rar" file gives an error
"an unexpected error prevents extraction from the archive".
it is possible to have a new version.
Thank you
 

PABLO2013

Well-Known Member
Licensed User
Longtime User
Greetings, if nothing else, you must copy both parts and decompress the first to the second, it will automatically decompress.
 
Top