summaryrefslogtreecommitdiff
path: root/android-app/app/src/main/kotlin/org
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-03-14 05:29:59 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-03-14 05:29:59 +0000
commitc7b42ab248cc1b3e8652469571121eb1a039d831 (patch)
treef0f3d0b6414c21035eb4760fd1eb59c5f6d9acf3 /android-app/app/src/main/kotlin/org
parenta3f6c1f13aafc087fd5570e015cf7ff68b84d651 (diff)
fix: replace invalid OpenSeaMap style URL with working base map + seamark overlay
The previous URL (tiles.openseamap.org/.../style.json) is not a valid MapLibre GL style — OpenSeaMap only provides raster tile overlays. Switch to OpenFreeMap liberty style as the base map and add OpenSeaMap seamark tiles as a raster overlay layer. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'android-app/app/src/main/kotlin/org')
-rw-r--r--android-app/app/src/main/kotlin/org/terst/nav/MainActivity.kt12
1 files changed, 11 insertions, 1 deletions
diff --git a/android-app/app/src/main/kotlin/org/terst/nav/MainActivity.kt b/android-app/app/src/main/kotlin/org/terst/nav/MainActivity.kt
index ccdf3b4..d99bf85 100644
--- a/android-app/app/src/main/kotlin/org/terst/nav/MainActivity.kt
+++ b/android-app/app/src/main/kotlin/org/terst/nav/MainActivity.kt
@@ -27,8 +27,11 @@ import org.maplibre.android.maps.Style
import org.maplibre.android.style.layers.CircleLayer
import org.maplibre.android.style.expressions.Expression
import org.maplibre.android.style.layers.PropertyFactory
+import org.maplibre.android.style.layers.RasterLayer
import org.maplibre.android.style.layers.SymbolLayer
import org.maplibre.android.style.sources.GeoJsonSource
+import org.maplibre.android.style.sources.RasterSource
+import org.maplibre.android.style.sources.TileSet
import org.maplibre.geojson.Feature
import org.maplibre.geojson.FeatureCollection
import org.maplibre.geojson.Point
@@ -179,7 +182,14 @@ class MainActivity : AppCompatActivity() {
mapView?.onCreate(savedInstanceState)
mapView?.getMapAsync { maplibreMap ->
this.maplibreMap = maplibreMap // Assign to class member
- maplibreMap.setStyle(Style.Builder().fromUri("https://tiles.openseamap.org/seamark/osm-bright/style.json")) { style ->
+ val style = Style.Builder()
+ .fromUri("https://tiles.openfreemap.org/styles/liberty")
+ .withSource(RasterSource("openseamap-source",
+ TileSet("2.2.0", "https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png").also {
+ it.setMaxZoom(18f)
+ }, 256))
+ .withLayer(RasterLayer("openseamap-layer", "openseamap-source"))
+ maplibreMap.setStyle(style) { style ->
setupAnchorMapLayers(style)
setupTidalCurrentMapLayers(style)
observeTidalCurrentState() // Start observing tidal current state