Skip to content

Commit 9f1840a

Browse files
committed
Remove vector tile providers
1 parent bc9f80d commit 9f1840a

7 files changed

Lines changed: 46 additions & 167 deletions

File tree

docs/MAP_TYPES.md

Lines changed: 30 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This guide helps you choose and configure the right map type for your OpenMapVie
44

55
## Quick Start
66

7-
OpenMapView provides **10 map types** matching the OpenStreetMap.org layer switcher. Six types work without any configuration, while four premium types require free API keys.
7+
OpenMapView provides **9 map types** matching the OpenStreetMap.org layer switcher. Six types work without any configuration, while three premium types require free API keys.
88

99
```kotlin
1010
val mapView = OpenMapView(context)
@@ -49,7 +49,7 @@ mapView.setMapType(MapType.CYCLOSM)
4949
```
5050

5151
#### 3. HUMANITARIAN - Emergency Response
52-
**`MapType.HUMANITARIAN`** (constant value: 6)
52+
**`MapType.HUMANITARIAN`** (constant value: 7)
5353

5454
Humanitarian OpenStreetMap Team (HOT) style with red/orange color scheme.
5555

@@ -65,7 +65,7 @@ mapView.setMapType(MapType.HUMANITARIAN)
6565
```
6666

6767
#### 4. OPNVKARTE - German Public Transport
68-
**`MapType.OPNVKARTE`** (constant value: 7)
68+
**`MapType.OPNVKARTE`** (constant value: 8)
6969

7070
Detailed public transport map focusing on German transit networks.
7171

@@ -142,8 +142,27 @@ Public transport focused map with comprehensive transit information.
142142
mapView.setMapType(MapType.TRANSPORT)
143143
```
144144

145-
#### 8. TRACESTRACK_TOPO - Topographic Map
146-
**`MapType.TRACESTRACK_TOPO`** (constant value: 5) 🔑 **Requires Tracestrack API Key**
145+
#### 8. TRANSPORT_DARK - Dark Mode Public Transit Map
146+
**`MapType.TRANSPORT_DARK`** (constant value: 5) **Requires Thunderforest API Key**
147+
148+
Dark variant of the public transport map with comprehensive transit information in a dark color scheme.
149+
150+
- **Best for**: Night mode transit apps, low-light journey planning, dark mode applications
151+
- **Features**: Bus routes, train lines, tram tracks, transit stations
152+
- **Highlights**: Dark color scheme suitable for night mode
153+
- **Tile Server**: tile.thunderforest.com
154+
- **Max Zoom**: 21
155+
- **Free Tier**: 150,000 tiles/month
156+
- **Get API Key**: https://www.thunderforest.com/pricing/
157+
- **Attribution**: © OpenStreetMap contributors. Tiles courtesy of Andy Allan
158+
159+
```kotlin
160+
// Same API key as CYCLEMAP and TRANSPORT
161+
mapView.setMapType(MapType.TRANSPORT_DARK)
162+
```
163+
164+
#### 9. TRACESTRACK_TOPO - Topographic Map
165+
**`MapType.TRACESTRACK_TOPO`** (constant value: 6) **Requires Tracestrack API Key**
147166

148167
Detailed topographic map with elevation contours and hillshading.
149168

@@ -168,25 +187,6 @@ ApiKeyManager.setApiKey("tracestrack", "your_key_here")
168187
mapView.setMapType(MapType.TRACESTRACK_TOPO)
169188
```
170189

171-
#### 9. MAPTILER_OMT - OpenMapTiles Vector Style
172-
**`MapType.MAPTILER_OMT`** (constant value: 9) 🔑🚧 **Not Yet Supported**
173-
174-
High-quality vector tile map based on OpenMapTiles schema.
175-
176-
- **Status**: Not yet supported - requires MapLibre GL integration
177-
- **Get API Key**: https://www.maptiler.com/cloud/plans/
178-
- **Free Tier**: 100,000 tiles/month
179-
180-
### Vector Tile Support
181-
182-
#### 10. SHORTBREAD - Modern Vector Style
183-
**`MapType.SHORTBREAD`** (constant value: 8) 🚧 **Not Yet Supported**
184-
185-
Modern, clean vector-based map style.
186-
187-
- **Status**: Not yet supported - requires MapLibre GL integration
188-
- **No API Key Required**
189-
190190
## API Key Configuration
191191

192192
### Method 1: AndroidManifest.xml (Recommended)
@@ -195,7 +195,7 @@ Add API keys to your app's `AndroidManifest.xml`:
195195

196196
```xml
197197
<application>
198-
<!-- Thunderforest (for CYCLEMAP and TRANSPORT) -->
198+
<!-- Thunderforest (for CYCLEMAP, TRANSPORT, and TRANSPORT_DARK) -->
199199
<meta-data
200200
android:name="de.afarber.openmapview.THUNDERFOREST_API_KEY"
201201
android:value="your_thunderforest_key_here"/>
@@ -204,11 +204,6 @@ Add API keys to your app's `AndroidManifest.xml`:
204204
<meta-data
205205
android:name="de.afarber.openmapview.TRACESTRACK_API_KEY"
206206
android:value="your_tracestrack_key_here"/>
207-
208-
<!-- MapTiler (for MAPTILER_OMT - when supported) -->
209-
<meta-data
210-
android:name="de.afarber.openmapview.MAPTILER_API_KEY"
211-
android:value="your_maptiler_key_here"/>
212207
</application>
213208
```
214209

@@ -221,30 +216,23 @@ import de.afarber.openmapview.ApiKeyManager
221216

222217
ApiKeyManager.setApiKey("thunderforest", "your_key_here")
223218
ApiKeyManager.setApiKey("tracestrack", "your_key_here")
224-
ApiKeyManager.setApiKey("maptiler", "your_key_here")
225219
```
226220

227221
### Obtaining API Keys
228222

229223
All providers offer generous free tiers suitable for development and small-scale production use:
230224

231-
#### Thunderforest (CYCLEMAP, TRANSPORT)
225+
#### Thunderforest (CYCLEMAP, TRANSPORT, TRANSPORT_DARK)
232226
- **Website**: https://www.thunderforest.com/pricing/
233227
- **Free Tier**: 150,000 tiles/month
234228
- **Sign Up**: Register for free account
235-
- **One key works for**: Both CYCLEMAP and TRANSPORT
229+
- **One key works for**: CYCLEMAP, TRANSPORT, and TRANSPORT_DARK
236230

237231
#### Tracestrack (TRACESTRACK_TOPO)
238232
- **Website**: https://www.tracestrack.com/en/signup
239233
- **Free Tier**: 100,000 tiles/month
240234
- **Sign Up**: Register for free account
241235

242-
#### MapTiler (MAPTILER_OMT)
243-
- **Website**: https://www.maptiler.com/cloud/plans/
244-
- **Free Tier**: 100,000 tiles/month
245-
- **Sign Up**: Register for free account
246-
- **Note**: MAPTILER_OMT not yet supported (vector tiles)
247-
248236
### Security Best Practices
249237

250238
1. **Use Domain Restrictions**: Configure API keys on provider websites to restrict usage to your app's domain/bundle ID
@@ -262,6 +250,7 @@ All providers offer generous free tiers suitable for development and small-scale
262250
| Cycling/bike app (free) | `CYCLOSM` |
263251
| Cycling/bike app (premium) | `CYCLEMAP` (requires API key) |
264252
| Public transit app | `TRANSPORT` (requires API key) |
253+
| Public transit app (dark mode) | `TRANSPORT_DARK` (requires API key) |
265254
| German transit app | `OPNVKARTE` |
266255
| Hiking/outdoor app | `TRACESTRACK_TOPO` (requires API key) |
267256
| Emergency/humanitarian | `HUMANITARIAN` |
@@ -294,8 +283,8 @@ See `PredefinedTileProviders.kt` for predefined overlay sources, or create custo
294283
## Example Usage
295284

296285
See the **Example11MapTypes** sample app for a complete demonstration of all map types with:
297-
- Buttons to switch between all 10 map types
298-
- Visual indicators for API key requirements (🔑) and coming soon features (🚧)
286+
- Buttons to switch between all 9 map types
287+
- Visual indicators for API key requirements
299288
- Descriptions of each map type
300289
- Instructions for API key configuration
301290

openmapview/src/main/kotlin/de/afarber/openmapview/ApiKeyManager.kt

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import java.util.concurrent.ConcurrentHashMap
1515
/**
1616
* Manages API keys for third-party tile providers.
1717
*
18-
* Some map types (CYCLEMAP, TRANSPORT, TRACESTRACK_TOPO, MAPTILER_OMT) require API keys
18+
* Some map types (CYCLEMAP, TRANSPORT, TRANSPORT_DARK, TRACESTRACK_TOPO) require API keys
1919
* from tile providers. Keys can be configured in two ways:
2020
*
2121
* **1. AndroidManifest.xml** (Recommended):
@@ -27,30 +27,24 @@ import java.util.concurrent.ConcurrentHashMap
2727
* <meta-data
2828
* android:name="de.afarber.openmapview.TRACESTRACK_API_KEY"
2929
* android:value="your_tracestrack_key_here"/>
30-
* <meta-data
31-
* android:name="de.afarber.openmapview.MAPTILER_API_KEY"
32-
* android:value="your_maptiler_key_here"/>
3330
* </application>
3431
* ```
3532
*
3633
* **2. Programmatically** (Runtime):
3734
* ```kotlin
3835
* ApiKeyManager.setApiKey("thunderforest", "your_key_here")
3936
* ApiKeyManager.setApiKey("tracestrack", "your_key_here")
40-
* ApiKeyManager.setApiKey("maptiler", "your_key_here")
4137
* ```
4238
*
4339
* API keys set programmatically override keys from the manifest.
4440
*
4541
* ## Provider Names
46-
* - `"thunderforest"` - For CYCLEMAP and TRANSPORT map types
42+
* - `"thunderforest"` - For CYCLEMAP, TRANSPORT, and TRANSPORT_DARK map types
4743
* - `"tracestrack"` - For TRACESTRACK_TOPO map type
48-
* - `"maptiler"` - For MAPTILER_OMT map type (vector tiles, not yet supported)
4944
*
5045
* ## Obtaining API Keys
5146
* - **Thunderforest**: https://www.thunderforest.com/pricing/ (Free: 150k tiles/month)
5247
* - **Tracestrack**: https://www.tracestrack.com/en/signup (Free tier available)
53-
* - **MapTiler**: https://www.maptiler.com/cloud/plans/ (Free: 100k tiles/month)
5448
*
5549
* @see TileSource
5650
* @see MapType
@@ -59,7 +53,6 @@ object ApiKeyManager {
5953
private const val META_DATA_PREFIX = "de.afarber.openmapview."
6054
private const val THUNDERFOREST_KEY_NAME = "THUNDERFOREST_API_KEY"
6155
private const val TRACESTRACK_KEY_NAME = "TRACESTRACK_API_KEY"
62-
private const val MAPTILER_KEY_NAME = "MAPTILER_API_KEY"
6356

6457
/**
6558
* Thread-safe storage for API keys set programmatically.
@@ -116,7 +109,7 @@ object ApiKeyManager {
116109
*
117110
* Keys set this way override keys from AndroidManifest.xml.
118111
*
119-
* @param provider Provider name ("thunderforest", "tracestrack", or "maptiler")
112+
* @param provider Provider name ("thunderforest" or "tracestrack")
120113
* @param key API key string
121114
*/
122115
@Synchronized
@@ -132,7 +125,7 @@ object ApiKeyManager {
132125
*
133126
* Checks programmatic keys first, then falls back to manifest meta-data.
134127
*
135-
* @param provider Provider name ("thunderforest", "tracestrack", or "maptiler")
128+
* @param provider Provider name ("thunderforest" or "tracestrack")
136129
* @return API key string, or null if not configured
137130
*/
138131
@Synchronized
@@ -147,7 +140,6 @@ object ApiKeyManager {
147140
when (normalizedProvider) {
148141
"thunderforest" -> META_DATA_PREFIX + THUNDERFOREST_KEY_NAME
149142
"tracestrack" -> META_DATA_PREFIX + TRACESTRACK_KEY_NAME
150-
"maptiler" -> META_DATA_PREFIX + MAPTILER_KEY_NAME
151143
else -> null
152144
}
153145

@@ -157,7 +149,7 @@ object ApiKeyManager {
157149
/**
158150
* Checks if an API key is configured for the given provider.
159151
*
160-
* @param provider Provider name ("thunderforest", "tracestrack", or "maptiler")
152+
* @param provider Provider name ("thunderforest" or "tracestrack")
161153
* @return true if a key is available, false otherwise
162154
*/
163155
fun hasApiKey(provider: String): Boolean = !getApiKey(provider).isNullOrEmpty()

openmapview/src/main/kotlin/de/afarber/openmapview/MapController.kt

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,6 @@ class MapController(
258258
* - Creates an overlay indicating the missing API key
259259
* - The map remains interactive (touch events pass through)
260260
*
261-
* If the map type is vector-based (not yet supported):
262-
* - Falls back to STANDARD tile source
263-
* - Creates an overlay indicating vector tiles are not yet supported
264-
*
265261
* @param mapType The MapType constant
266262
*/
267263
fun setMapType(mapType: Int) {
@@ -273,22 +269,8 @@ class MapController(
273269
// Get the tile source for this map type
274270
val source = TileSource.fromMapType(mapType)
275271

276-
// Check if the tile source is supported (not vector tiles)
277-
if (!source.isSupported()) {
278-
// Vector tiles not supported - use STANDARD and show overlay
279-
actualTileSource = TileSource.STANDARD
280-
apiKeyErrorOverlay =
281-
ApiKeyErrorOverlay(
282-
context,
283-
source.getProviderName(),
284-
TileSource.getMapTypeName(mapType),
285-
)
286-
android.util.Log.i(
287-
"OpenMapView",
288-
"${TileSource.getMapTypeName(mapType)} requires vector tile support (MapLibre GL). " +
289-
"Displaying STANDARD map instead.",
290-
)
291-
} else if (source.requiresApiKey && !source.hasApiKey()) {
272+
// Check if an API key is required but not configured
273+
if (source.requiresApiKey && !source.hasApiKey()) {
292274
// API key required but not configured - use STANDARD and show overlay
293275
actualTileSource = TileSource.STANDARD
294276
apiKeyErrorOverlay =

openmapview/src/main/kotlin/de/afarber/openmapview/MapType.kt

Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,21 @@ package de.afarber.openmapview
1010
/**
1111
* Map type constants for OpenMapView.
1212
*
13-
* Defines 10 map tile styles matching the openstreetmap.org layer switcher.
14-
* Six map types work without API keys, four require API keys from third-party providers.
13+
* Defines 9 map tile styles matching the openstreetmap.org layer switcher.
14+
* Six map types work without API keys, three require API keys from third-party providers.
1515
*
1616
* **Free Map Types (No API Key Required):**
1717
* - [NONE]: No base map tiles
1818
* - [STANDARD]: Default OpenStreetMap Mapnik rendering
1919
* - [CYCLOSM]: Cycling-focused map from OpenStreetMap France
2020
* - [HUMANITARIAN]: Humanitarian OSM style for emergency response
2121
* - [OPNVKARTE]: German public transport map
22-
* - [SHORTBREAD]: Modern vector tile style (not yet supported)
2322
*
2423
* **Premium Map Types (API Key Required):**
2524
* - [CYCLEMAP]: Thunderforest cycling map (requires Thunderforest API key)
2625
* - [TRANSPORT]: Public transport focused map (requires Thunderforest API key)
26+
* - [TRANSPORT_DARK]: Dark mode public transport map (requires Thunderforest API key)
2727
* - [TRACESTRACK_TOPO]: Topographic with contours (requires Tracestrack API key)
28-
* - [MAPTILER_OMT]: OpenMapTiles vector style (requires MapTiler API key, not yet supported)
2928
*
3029
* ## API Key Configuration
3130
*
@@ -37,9 +36,6 @@ package de.afarber.openmapview
3736
* <meta-data
3837
* android:name="de.afarber.openmapview.TRACESTRACK_API_KEY"
3938
* android:value="your_key_here"/>
40-
* <meta-data
41-
* android:name="de.afarber.openmapview.MAPTILER_API_KEY"
42-
* android:value="your_key_here"/>
4339
* ```
4440
*
4541
* Or programmatically:
@@ -51,12 +47,10 @@ package de.afarber.openmapview
5147
* with an overlay indicating the missing key. The map remains interactive.
5248
*
5349
* ## Obtaining API Keys
54-
* - **Thunderforest** (CYCLEMAP, TRANSPORT): https://www.thunderforest.com/pricing/
50+
* - **Thunderforest** (CYCLEMAP, TRANSPORT, TRANSPORT_DARK): https://www.thunderforest.com/pricing/
5551
* - Free tier: 150,000 tiles/month
5652
* - **Tracestrack** (TRACESTRACK_TOPO): https://www.tracestrack.com/en/signup
5753
* - Free tier: 100,000 tiles/month
58-
* - **MapTiler** (MAPTILER_OMT): https://www.maptiler.com/cloud/plans/
59-
* - Free tier: 100,000 tiles/month
6054
*
6155
* @see OpenMapView.setMapType
6256
* @see OpenMapView.getMapType
@@ -185,38 +179,4 @@ object MapType {
185179
* - **Use Cases**: German transit apps, ÖPNV journey planning
186180
*/
187181
const val OPNVKARTE: Int = 8
188-
189-
/**
190-
* Shortbread - Modern vector tile style.
191-
*
192-
* Modern, clean vector-based map style with smooth rendering and customizable styling.
193-
*
194-
* **Note**: Vector tiles are not yet supported in OpenMapView. This map type requires
195-
* MapLibre GL integration which is planned for a future release. Selecting this type
196-
* will display a "not yet supported" overlay.
197-
*
198-
* - **Tile Server**: vector.openstreetmap.org
199-
* - **Max Zoom**: 23
200-
* - **API Key**: Not required
201-
* - **Status**: Coming soon
202-
*/
203-
const val SHORTBREAD: Int = 9
204-
205-
/**
206-
* MapTiler OMT - OpenMapTiles vector style.
207-
*
208-
* High-quality vector tile map based on OpenMapTiles schema. Provides smooth
209-
* rendering, client-side styling, and excellent performance.
210-
*
211-
* **Note**: Vector tiles are not yet supported in OpenMapView. This map type requires
212-
* MapLibre GL integration and a MapTiler API key. Planned for a future release.
213-
*
214-
* - **Tile Server**: api.maptiler.com
215-
* - **Max Zoom**: 23
216-
* - **API Key**: Required (MapTiler)
217-
* - **Status**: Coming soon
218-
*
219-
* @see ApiKeyManager
220-
*/
221-
const val MAPTILER_OMT: Int = 10
222182
}

openmapview/src/main/kotlin/de/afarber/openmapview/OpenMapView.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -444,11 +444,10 @@ class OpenMapView
444444
* - [MapType.CYCLOSM] - Cycling-focused map style
445445
* - [MapType.CYCLEMAP] - Thunderforest cycling map (requires API key)
446446
* - [MapType.TRANSPORT] - Public transport map (requires API key)
447+
* - [MapType.TRANSPORT_DARK] - Dark mode public transport map (requires API key)
447448
* - [MapType.TRACESTRACK_TOPO] - Topographic map with contour lines (requires API key)
448449
* - [MapType.HUMANITARIAN] - Humanitarian-focused style
449450
* - [MapType.OPNVKARTE] - German public transport
450-
* - [MapType.SHORTBREAD] - Vector tiles (not yet supported)
451-
* - [MapType.MAPTILER_OMT] - Vector tiles (not yet supported, requires API key)
452451
*
453452
* When the map type changes, the tile cache is cleared and the map is redrawn.
454453
*
@@ -465,16 +464,16 @@ class OpenMapView
465464
*/
466465
fun setMapType(type: Int) {
467466
// Validate map type
468-
if (type !in 0..10) {
469-
throw IllegalArgumentException("Unknown map type: $type. Must be a valid MapType constant (0-10).")
467+
if (type !in 0..8) {
468+
throw IllegalArgumentException("Unknown map type: $type. Must be a valid MapType constant (0-8).")
470469
}
471470

472471
currentMapType = type
473472
controller.setMapType(type)
474473

475474
// Update attribution for the actual tile source being used
476475
val source = TileSource.fromMapType(type)
477-
if (type != MapType.NONE && source.isSupported()) {
476+
if (type != MapType.NONE) {
478477
attributionOverlay.setAttributionText(source.attributionText)
479478
attributionOverlay.setAttributionUrl(source.attributionUrl)
480479
}

0 commit comments

Comments
 (0)