Android Question RFC: What does a minimum OSMDroid needs on features

DonManfred

Expert
Licensed User
Longtime User
Request for comments

I´m playing around with OSMDroid doing a new wrapper for it. Just out of fun. ;-)

Which features does the Library needs at minimum to get released?

As of now i can load a map using openstreetmap tiles (online), use offline tiles, show compassoverlay, own locationoverlay, mapscaleoverlay, minimapoverlay with the wrapper already written.

A lot is missing but i want to know which feature(s) i should focus when continuing writing the wrapper.

Any comments are welcome ;-)
 

junglejet

Active Member
Licensed User
Longtime User
Hello Don Manfredo,
it is great news that you start B4A OSMDroid again, I was never able to install the library by warwound, because the genuine Android libs are not available on Github(?) anymore.
I have the following requests:
- select different tile servers and manage offline maps (another overlay tile server: https://1.tile.maps.openaip.net)
- be able to draw customized markers that are, sizeable, colorable, rotable
- be able to draw customized labels re fonts, typeface, size, background color, must not be rotable
- be able to draw polylines, circles, areas (closed and filled polylines)
- when overlaying another map layer the zoom function is often disabled, because the event is not passed to the bottom layer. It would be nice if this can be avoided
Thank you for all your efforts
Andy from HH (I assume close to you)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Hello Don Manfredo,
Please use DonManfred (one word, without O at end)!

be able to draw customized markers that are, sizeable, colorable, rotable
Is this available in the existing OSMDroid Library?
If not and you are posting wishes for new features the OSMDROID does not provide then you should read my answere here.
when overlaying another map layer the zoom function is often disabled, because the event is not passed to the bottom layer. It would be nice if this can be avoided
In my tests the zoom never stopped to work.
Andy from HH (I assume close to you)
in German: Düren bei Köln...
be able to draw customized labels re fonts, typeface, size, background color, must not be rotable
The Markerwindows and everything about it is only working partially. OSMDroid uses features which depends in the requirement to use XML Layouts with some fields which must be included here. So we are a bit limited.

I need to learn how this works. Did not get it working as of now (not tried at all 😂 ).
 
Upvote 0

js486dog

Active Member
Licensed User
Longtime User
Request for comments

I´m playing around with OSMDroid doing a new wrapper for it. Just out of fun. ;-)

Which features does the Library needs at minimum to get released?

As of now i can load a map using openstreetmap tiles (online), use offline tiles, show compassoverlay, own locationoverlay, mapscaleoverlay, minimapoverlay with the wrapper already written.

A lot is missing but i want to know which feature(s) i should focus when continuing writing the wrapper.

Any comments are welcome ;-)
Maybe this will be usefull to you.
Some examples of OsmDroid 4.1:
- draw points with text labels
- draw lines
- draw polygons with text labels
- draw markers with text labels
Lat Lon of points, texts for labels are from database (List).
It works for me.

B4X:
Sub Process_Globals
    Dim BodVrstvy As OSMDroid_GeoPoint
End Sub

Sub Globals
    Dim MapView1 As OSMDroid_MapView
    Dim CircleOverlay1 As OSMDroid_CircleOverlay
    Dim ViewHostOverlay1 As OSMDroid_ViewHostOverlay
    Dim ViewHostOverlay2 As OSMDroid_ViewHostOverlay
    Dim MarkersOverlay1 As OSMDroid_MarkerOverlay
    Dim PathOverlay1 As OSMDroid_PathOverlay
End Sub


Sub draw_points ()
    
    Dim List1 As List
    CircleOverlay1.Initialize

    List1 = File.ReadList(File.DirRootExternal, "/GPStxt/" & konec_suboru)

    For i = 0 To List1.Size-1
        
        If sf.Len(List1.Get(i))>0  Then

            Dim str() As String
            str = Regex.split(":", List1.Get(i))

            CircleOverlayItem1=CircleOverlay1.AddCircleOverlayItem2(str(1), str(2), 4, CircleOverlay1.RADIUS_UNITS_TYPE_PIXELS, 1dip,Colors.Blue)
            If typoly="plny" Then CircleOverlayItem1.StrokeStyle=CircleOverlayItem1.FILL_AND_STROKE
            If typoly="prazdny" Then CircleOverlayItem1.StrokeStyle=CircleOverlayItem1.STROKE
        Else
        End If
    Next
    MapView1.GetOverlays.Add(CircleOverlay1)
    '------------------------------
    For i = 0 To List1.Size-1
        If sf.Len(List1.Get(i))>0  Then
            
            Dim strzn() As String
            strzn = Regex.split(":", List1.Get(i))
            Dim marker1 As OSMDroid_Marker ' Marker
            marker1.Initialize("",strzn(0), strzn(1), strzn(2))
            Dim MarkerLabel As Label
            MarkerLabel.Initialize("")
            MarkerLabel.Color=Colors.Transparent
            MarkerLabel.TextColor= Colors.Red
            MarkerLabel.TextSize=16
            MarkerLabel.Text=strzn(0)
            Dim ViewHost2 As OSMDroid_ViewHost
            ViewHost2.Initialize(MarkerLabel, marker1.GetPoint, 0, 0, Constants1.LayoutParams.ALIGN_TOP_CENTER, True)
            ViewHostOverlay2.AddItem(ViewHost2)
        End If
    Next

    '------------------------------
    MapView1.Invalidate
End Sub


Sub draw_line ()
        
    Dim List1 As List
    List1 = File.ReadList(File.DirRootExternal, "/GPStxt/" & konec_suboru)
    
    For i = 0 To List1.Size-1
        
            If ListView4.size >0 Then
                
                PathOverlay1.Initialize(MapView1,Colors.RGB(255,111,0))
                PathOverlay1.ClearPath
                MapView1.GetOverlays.Add(PathOverlay1)
                PathOverlay1.SetStrokeWidth(4)
                PathOverlay1.SetAlpha(250)
                PathOverlay1.SetPathStyle("STROKE")
                            
                For li = 0 To ListView4.size -1
                    Dim str() As String
                    str = Regex.split(":", ListView4.GetItem(li))
                    BodVrstvy.Initialize(str(0),str(1))
                    PathOverlay1.AddPoint(BodVrstvy)
                Next
                ListView4.Clear
            Else
            End If
    Next

    MapView1.Invalidate
End Sub


Sub draw_polygon ()
        
    Dim List1 As List
    List1 = File.ReadList(File.DirRootExternal, "/GPStxt/" & konec_suboru)

    For i = 0 To List1.Size-1
            If ListView4.size >0 Then

                PathOverlay1.Initialize(MapView1,Colors.RGB(255,111,0))
                PathOverlay1.ClearPath
                MapView1.GetOverlays.Add(PathOverlay1)
                PathOverlay1.SetStrokeWidth(8)
                PathOverlay1.SetAlpha(250)
                If typoly="plny" Then PathOverlay1.SetPathStyle("FILL_AND_STROKE")
                If typoly="prazdny" Then PathOverlay1.SetPathStyle("STROKE")
                        
                For li = 0 To ListView4.size -1
                    Dim str() As String
                    str = Regex.split(":", ListView4.GetItem(li))
                    BodVrstvy.Initialize(str(0),str(1))
                    PathOverlay1.AddPoint(BodVrstvy)
                Next
            
                ListView4.Clear
            Else
            End If
    Next
    '------------------------------
    If textv <>"0" Then
    For i = 0 To List1.Size-1
            Dim strzn() As String
            strzn = Regex.split(":", List1.Get(i))
            Dim marker1 As OSMDroid_Marker
            marker1.Initialize("",strzn(1), strzn(2), strzn(3))
            Dim MarkerLabel As Label
            MarkerLabel.Initialize("")
            MarkerLabel.Color=Colors.Transparent
            MarkerLabel.TextColor= Colors.Red
            MarkerLabel.TextSize=16
            MarkerLabel.Text=strzn(1)
            Dim ViewHost2 As OSMDroid_ViewHost
            ViewHost2.Initialize(MarkerLabel, marker1.GetPoint, 0, 0, Constants1.LayoutParams.ALIGN_TOP_CENTER, True)
            ViewHostOverlay2.AddItem(ViewHost2)
    Next
    End If
    
    MapView1.Invalidate
    '------------------------------
End Sub


Sub draw_markers
    ' kde.png, kde1.png, markery.png, markery1.png are in "drawable-nodpi" folder

    For i = 0 To ListView1.size -1
        Dim str() As String
        str = Regex.split(":", ListView1.GetItem(i))
        
        Dim AndroidResources1 As AndroidResources
        Dim Icon As BitmapDrawable
        If smarker=1 Then Icon=AndroidResources1.GetApplicationDrawable("kde") Else Icon=AndroidResources1.GetApplicationDrawable("kde1")
        
        Dim Icon1 As BitmapDrawable
        If smarker=1 Then Icon1=AndroidResources1.GetApplicationDrawable("markery") Else Icon1=AndroidResources1.GetApplicationDrawable("markery1")
  
        Dim marker1 As OSMDroid_Marker
        If str(1)=daj_lat And str(2)=daj_lon Then
            marker1.Initialize("",str(0), str(1), str(2))
            marker1.SetMarkerIcon(Icon)
        Else
            marker1.Initialize("",str(0), str(1), str(2))
            marker1.SetMarkerIcon(Icon1)
        End If
        
        Dim MarkerLabel As Label
        MarkerLabel.Initialize("")
        MarkerLabel.Color=Colors.Transparent
        MarkerLabel.TextColor = Colors.Blue
        MarkerLabel.TextSize = 14

        Try
            If Label23.Text="N" Then MarkerLabel.Text=str(0) Else MarkerLabel.Text=str(5)
        Catch
            MarkerLabel.Text=str(0)
        End Try
        
        Dim ViewHost1 As OSMDroid_ViewHost
        ViewHost1.Initialize(MarkerLabel, marker1.GetPoint, 0, 0, Constants1.LayoutParams.ALIGN_TOP_CENTER, True)
        ViewHostOverlay1.AddItem(ViewHost1)
        
        Dim Markers As List
        Markers.Initialize2(Array As Object(marker1))
        MarkersOverlay1.AddItems(Markers)    'MarkersOverlay1.AddMarkers(Markers)
    Next

    MapView1 .Invalidate

End Sub
 
Upvote 0

junglejet

Active Member
Licensed User
Longtime User
Maybe this will be usefull to you.
Some examples of OsmDroid 4.1:
- draw points with text labels
- draw lines
- draw polygons with text labels
- draw markers with text labels
Lat Lon of points, texts for labels are from database (List).
It works for me.

Hello, this is about what I need. But I have never been able to try OSMdroid 4.1, because the NativeOSMDroid library was removed from the posts and I cannot find them elsewhere.

Library reference is no longer included in this post due to limits on the number of characters allowed in a single post.
I have slf4j-android-1.5.8.jar. Do you know where the NativeOSMDroid library can be found?

Andy
 
Upvote 0

junglejet

Active Member
Licensed User
Longtime User
Hello DonManfred,
Thank you very much, very helpful.
But I fiddled around (again) for many hours, without success. The MapView object is never found in the "simplemap" example.
I tried b4a 3.08 and 4.1, with and without sl4j-android-1.6.1-RC1, with osmdroid-android.jar from 3.08 and 4.1. As the post says without XML files.
But finally the post spreads over 20+ pages and it is almost impossible to read and understand what is really meant. I would not consider myself being a beginner after 40 years of source coding (albeit no Java), but this first step is already mega confusing. Sorry to say. It is probably just a simple snag.
I am on B4A 9.x
Happy new year
Andy

osmdroid.jpg
 
Upvote 0

junglejet

Active Member
Licensed User
Longtime User
Ok, then I am stuck, and I cannot make better suggestion based on the old lib.
The latest B4A lib I can find is 4.1 which is said to require native lib 4.1. To me there is no reason why this should not work, but it does not.
The up-to-date native lib is 6.1.5 which seems cannot be used together with B4A for now. I shall wait until your wrapper is available.
 
Upvote 0

divinglog

Member
Licensed User
Longtime User
Hi DonManfred

I would like to use OSMDroid in my app and would like to ask if I can help you to finish a first release of this OSM wrapper? Currently I'm using this library, but it does not support pinch-to-zoom:


Please let me know and I'm happy to help completing this project.

Thank you
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
As you can see this thread is >2 Years old. I started it in 2019 for a customer which then decided to use GoogleMaps in easy 2020.
I did not developed it further then. There is no public version of it and don´t expect one coming.
 
Last edited:
Upvote 0

divinglog

Member
Licensed User
Longtime User
OK, thank you for the reply. That's why I've asked if I can help you to complete your code and get it published for everyone. But looks like I have to start from scratch. I'll see if I can get it done, because I think an OSM wrapper is really useful for the B4A community. If anyone from this thread want's to join, please contact me.
 
Upvote 0

divinglog

Member
Licensed User
Longtime User
That would be great and really helpful, thank you! I'll try my best to get it to a release and publish it here. Of course all rights to the source belong to you and I'll send the source back to you if I can get it done. If you want, you can send it to my email [email protected]
 
Upvote 0
Top