Android Question Viewing a single map from a OSM file, without downloading tiles

Lakhtin_V

Active Member
Licensed User
Longtime User
In all examples by OSM, map is built from tiles, with access to the INTERNET. In my application, all work takes place on a predetermined section of the map. I want the application to work offline. I don't want to download tiles from the OCM server. I already have one file with the OCM extension, with a map of the area I need. How should I redo the code so that this map, a pre-downloaded map is displayed. I received the file with the OSM map on the main site of the mapsource project using export.
All examples use tile downloads and require certain registration and restrictions. Where can I find a primitive example of displaying a pre-downloaded single file? Is it possible in this case, after displaying, to add markers to it?
 

Lakhtin_V

Active Member
Licensed User
Longtime User
I tried this code but it doesn't work
OSM map:
        Dim mapAty As MapView
        ' Init MapView use lib [B]OSMDroid_3_0_8[/B]
        mapAtyrau.Initialize("map")
        Activity.AddView(mapAtyrau, 2%x, 30%y, 96%x, 59%y)
        
        ' Set Path OSM file
        Dim mapFile As String
        mapFile = File.Combine(File.DirInternal, "mapATY.osm")
        If File.Exists(File.DirInternal, "mapATY.osm") Then
            mapAtyrau.SetTileSource(mapFile)
        End If

error

B4A Version: 11.80
Parsing code. (0.09s)
Java Version: 11
Building folders structure. (0.01s)
Compiling code. (0.12s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
(AndroidX SDK)
Compiling resources (0.07s)
Linking resources (0.78s)
Compiling generated Java code. (1.90s)
Finding libraries that need to be dexed. (0.00s)
Dex code (1.58s)
Dex merge Error
Error in D:\B4X\Android\tools\..\extras\b4a_local\unpacked-osmdroid_3_0_8-63526302840000\dex_v1\osmdroid_3_0_8.zip:classes.dex:
Type org.slf4j.ILoggerFactory is defined multiple times: D:\B4X\Android\tools\..\extras\b4a_local\unpacked-osmdroid_3_0_8-63526302840000\dex_v1\osmdroid_3_0_8.zip:classes.dex, D:\B4X\Android\tools\..\extras\b4a_local\unpacked-moqueutte-63614376060000\dex_v1\moqueutte.zip:classes.dex
Compilation failed
 
Upvote 0
Top