OpenSeaMap

touchsquid

Active Member
Licensed User
Longtime User
I am in need of a B4X library for openseamap, similar to work Warwound has done.

In addition to displaying a nautical chart, it needs the following functions:
Add Markers from bitmap. Labels would be nice to have.
Add polylines
Get a Lat Long point from a "bullseye" in the center of the map by zooming and panning to a location. See attachments.

That is about it. I am prepared to pay a reasonable fee, and do not require ownership of the library, just the right to use it in my apps.

I will be using it in B4A, B4I, and possibly B4J.

Thanks for any suggestions or offers.

Touchsquid

Edit:
Problem solved by adding OpenSeaMap tileoverlay on Googlemaps, which has all the other features needed.
 

Attachments

  • PassageIrace.png
    PassageIrace.png
    118.2 KB · Views: 53
  • MapExample.png
    MapExample.png
    77.9 KB · Views: 48
Last edited:

Andrew (Digitwell)

Well-Known Member
Licensed User
Unless I am misunderstanding, all of these items are available already.

gmap.AddMarker3 - allows you to specify the bitmap to use. You need to be careful of the size of bitmap to use. You can change the "center" of the bitmap with SetGroundAnchor in the GoogleMapsExtra Library.

gmap.AddPolylines is available.

gmap.cameraposition - gets the current map centre and also the zoom level.

I use these across all B4X products all the time.

Labels is your only problem, but you could create them as markers, i suppose.

If you keep the return values from AddMarker3 and AddPolyline, you can show/hide/remove the overlays by code later if required.
 

Harris

Expert
Licensed User
Longtime User
Labels is your only problem, but you could create them as markers, i suppose.

Create markers on-the-fly...
 

touchsquid

Active Member
Licensed User
Longtime User
In Googlemaps I have no problem doing everything. It was the OpenSeaMap I was after. With some help, I now have OpenSeaMap tileoverlays showing on GoogleMaps so all is good.
 

touchsquid

Active Member
Licensed User
Longtime User
Gmap overlay of Seamap:
Globals
    Private Gmap1 As MapFragment
    Private GME As GoogleMapsExtras
    Private gmap As GoogleMap
    Private TOVopt As TileOverlayOptions
    pRIVATE MP As CustomUrlTileProvider
    Private Tolay As TileOverlay
end sub

Sub B4XPage_Appear
    
    Wait For Gmap1_Ready
    gmap = Gmap1.GetMap
    If gmap.IsInitialized Then
        gmap.MapType=gmap.MAP_TYPE_TERRAIN
        Tracker.rp.CheckAndRequest(Tracker.rp.PERMISSION_ACCESS_FINE_LOCATION)
        Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
        If Result Then
            StartService(Tracker)
            'wait for (Tracker.Start_Tracking ) complete (success As Boolean)
            'wait for LocationSource_Ready complete
        Else
            ToastMessageShow("No permission...", True)
            Log("No permission!")
        End If
    End If

    MP.initialize("MP",256,256)
    TOVopt.Initialize
    TOVopt = TOVopt.SetTileProvider(MP)
    TOVopt.SetZIndex(2)
    TOVopt.SetVisible(True)
    Tolay = GME.AddTileOverlay(gmap,TOVopt)
End Sub

Private Sub MP_GetTileUrl(TileX As Int, TileY As Int, Zoom As Int) As String
    Dim TileURL As String = "https://tiles.openseamap.org/seamark/"
    'Dim TileURL As String = "https://tile.openstreetmap.org/"
    Dim fURL As String =$"${TileURL}${Zoom}/${TileX}/${TileY}.png"$
    'Log(fURL)
    Return fURL
End Sub

Note that in debug modes the overlays do not show, but in release mode they work fine.
 
Top