fix: init tabs advert quick add

ref:
This commit is contained in:
Janez T
2026-02-28 11:23:11 +01:00
parent baf49d27d8
commit 6bd7517180
32 changed files with 850 additions and 11558 deletions

View File

@@ -1,726 +0,0 @@
# iOS Background Execution Guide
Complete guide for running MeshCore SAR in the background on iOS devices.
## Current Configuration Status
### ✅ Already Configured
Your app is **already set up** for background execution with the following capabilities:
#### 1. Info.plist Background Modes ([Info.plist:67-74](../ios/Runner/Info.plist#L67-L74))
```xml
<key>UIBackgroundModes</key>
<array>
<string>location</string> <!-- GPS tracking in background -->
<string>bluetooth-central</string> <!-- BLE communication in background -->
<string>processing</string> <!-- Background processing tasks -->
<string>external-accessory</string> <!-- External accessory communication -->
<string>fetch</string> <!-- Background fetch updates -->
</array>
```
#### 2. Location Permissions ([Info.plist:53-60](../ios/Runner/Info.plist#L53-L60))
```xml
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>MeshCore SAR needs location access for offline map functionality during field operations</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>MeshCore SAR needs location access to display team members and SAR markers on the map</string>
<key>NSLocationTemporaryPreciseUsageDescription</key>
<string>MeshCore SAR needs precise location for accurate positioning in SAR operations</string>
```
#### 3. Bluetooth Permissions ([Info.plist:49-52](../ios/Runner/Info.plist#L49-L52))
```xml
<key>NSBluetoothAlwaysUsageDescription</key>
<string>MeshCore SAR needs Bluetooth to communicate with MeshCore devices for Search &amp; Rescue operations</string>
```
#### 4. Background Task Identifiers ([Info.plist:5-8](../ios/Runner/Info.plist#L5-L8))
```xml
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>dev.flutter.background.refresh</string>
</array>
```
---
## How iOS Background Modes Work
### 1. Location Background Mode (`location`)
**What it does:**
- Keeps GPS active when app is backgrounded
- Delivers location updates to your app
- Shows blue status bar indicator: "MeshCore SAR is using your location"
**How to use:**
```dart
// Request "Always" permission (required for background location)
await Geolocator.requestPermission();
// Start tracking with distance filter
final settings = LocationSettings(
accuracy: LocationAccuracy.best,
distanceFilter: 10, // meters
);
final stream = Geolocator.getPositionStream(locationSettings: settings);
stream.listen((position) {
// This callback runs even when app is in background!
debugPrint('Background position: ${position.latitude}, ${position.longitude}');
});
```
**Current implementation:** [background_location_service.dart:69-75](../lib/services/background_location_service.dart#L69-L75)
**Battery impact:** Medium-High (depends on accuracy and distance filter)
**iOS limitations:**
- User must grant "Always Allow" location permission
- iOS shows blue banner when app uses background location
- Location updates may be deferred to save battery
- Maximum accuracy may be reduced after some time
---
### 2. Bluetooth Central Background Mode (`bluetooth-central`)
**What it does:**
- Keeps BLE connections alive when app is backgrounded
- Receives BLE notifications and read responses
- Can scan for known devices (limited)
**How to use:**
```dart
// flutter_blue_plus automatically uses background mode
await device.connect(); // Connection stays alive in background
// Subscribe to characteristics - notifications work in background
await characteristic.setNotifyValue(true);
characteristic.lastValueStream.listen((data) {
// This callback runs even when app is in background!
debugPrint('Background BLE data: $data');
});
```
**Current implementation:**
- [meshcore_ble_service.dart](../lib/services/meshcore_ble_service.dart) - BLE communication
- Connection and notifications already support background mode
**Battery impact:** Low-Medium
**iOS limitations:**
- Cannot start new connections from background (must be initiated in foreground)
- BLE scanning in background only finds previously connected devices
- Scanning is slower and less frequent in background
- Connection timeouts may be more aggressive
---
### 3. Processing Background Mode (`processing`)
**What it does:**
- Schedules background tasks to run when system conditions are optimal
- Used for non-urgent work (data sync, cache cleanup, etc.)
- System decides when to run tasks (not guaranteed)
**How to use:**
Requires `workmanager` package:
```yaml
dependencies:
workmanager: ^0.5.0
```
```dart
import 'package:workmanager/workmanager.dart';
void callbackDispatcher() {
Workmanager().executeTask((task, inputData) {
// This runs in background (system decides when)
debugPrint('Background task: $task');
return Future.value(true);
});
}
void main() {
Workmanager().initialize(callbackDispatcher);
Workmanager().registerPeriodicTask(
'mesh-sync',
'meshSync',
frequency: Duration(hours: 1),
);
}
```
**Current implementation:** Not currently used (task identifier registered but no handler)
**Battery impact:** Low (system schedules intelligently)
**iOS limitations:**
- Only runs when device is idle, plugged in, or has sufficient battery
- Minimum 15-minute intervals
- No guarantees on execution time
- May not run at all if battery is low
---
### 4. Fetch Background Mode (`fetch`)
**What it does:**
- Allows app to wake up periodically to fetch new content
- System learns usage patterns and schedules fetch intelligently
- More frequent than processing mode, but still not real-time
**How to use:**
Requires `background_fetch` package:
```yaml
dependencies:
background_fetch: ^1.3.0
```
```dart
import 'package:background_fetch/background_fetch.dart';
void backgroundFetchHandler(String taskId) async {
debugPrint('Background fetch: $taskId');
// Fetch new messages, sync data, etc.
await syncMessages();
BackgroundFetch.finish(taskId);
}
void initBackgroundFetch() {
BackgroundFetch.configure(
BackgroundFetchConfig(
minimumFetchInterval: 15, // minutes
stopOnTerminate: false,
enableHeadless: true,
),
backgroundFetchHandler,
).then((status) {
debugPrint('Background fetch status: $status');
});
}
```
**Current implementation:** Not currently used
**Battery impact:** Low-Medium
**iOS limitations:**
- System decides when to wake app (typically every 15-30 minutes)
- No guarantees on timing
- May not run if battery is low
- Requires network activity to "train" iOS
---
## Best Practices for SAR Operations
### Recommended Configuration
For a **Search & Rescue application**, prioritize real-time updates:
#### 1. Use Location Background Mode Exclusively
**Why:** Only location mode provides continuous updates while backgrounded.
**Implementation:**
```dart
// Start location tracking when BLE connects
await BackgroundLocationService().startTracking(distanceThreshold: 10.0);
// Location updates automatically trigger mesh broadcasts
// See: background_location_service.dart:75-135
```
**User experience:**
- Blue status bar shows "using location"
- Reassures users that tracking is active
- Critical for SAR where real-time location is life-or-death
#### 2. Request "Always Allow" Location Permission
**Why:** "When In Use" permission is revoked when app enters background.
**Implementation:**
```dart
// Check permission
final permission = await Geolocator.checkPermission();
if (permission != LocationPermission.always) {
// Show explanation to user
showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text('Background Location Required'),
content: Text(
'For SAR operations, we need "Always Allow" permission to track '
'your location even when the app is in the background. This ensures '
'your team can always see your position.'
),
actions: [
TextButton(
onPressed: () {
Geolocator.openLocationSettings();
},
child: Text('Open Settings'),
),
],
),
);
}
```
**User education:**
- Explain why "Always" is needed (safety, team coordination)
- Show value: "Your team can find you in an emergency"
- Emphasize battery impact and mitigation strategies
#### 3. Optimize Battery Life
**Distance Filter:**
```dart
// Don't send updates for small movements
const minDistance = 10.0; // meters
// Adjust based on terrain and operation type:
// - Urban search: 5m (frequent position changes)
// - Wilderness: 20m (sparse updates OK)
// - Vehicle-based: 50m (high speed, less precision needed)
```
**Accuracy vs. Battery:**
```dart
// High accuracy (GPS + GLONASS + Galileo)
LocationAccuracy.best // Best for SAR, but drains battery
// Balanced (GPS only)
LocationAccuracy.high // Good compromise
// Low accuracy (WiFi/cell towers)
LocationAccuracy.low // NOT recommended for SAR
```
**Current implementation:** Uses `LocationAccuracy.best` ([background_location_service.dart:72](../lib/services/background_location_service.dart#L72))
#### 4. Handle Background BLE Properly
**Connection Strategy:**
```dart
// Connect in foreground
await device.connect(autoConnect: true);
// Keep connection alive
device.connectionState.listen((state) {
if (state == BluetoothConnectionState.disconnected) {
// Attempt reconnect (only works if app is in foreground or shortly after background)
Future.delayed(Duration(seconds: 5), () {
device.connect(autoConnect: true);
});
}
});
```
**Characteristic Notifications:**
```dart
// Subscribe to notifications (works in background)
await characteristic.setNotifyValue(true);
// Process incoming data
characteristic.lastValueStream.listen((data) {
// Parse MeshCore frames even when backgrounded
final frame = FrameParser.parse(data);
// Update UI, save to database, trigger notifications
});
```
**Current implementation:** [meshcore_ble_service.dart](../lib/services/meshcore_ble_service.dart) already handles this correctly.
---
## iOS Background Limitations
### What Works in Background
**Location Updates** - Continuous GPS tracking
**BLE Notifications** - Receive data from connected device
**BLE Reads/Writes** - Communicate with connected device
**Local Notifications** - Display alerts to user
**Audio Playback** - Play alert sounds
**Network Requests** - Sync data, send telemetry
### What Doesn't Work in Background
**BLE Scanning** - Cannot discover new devices (limited scanning only for known UUIDs)
**New BLE Connections** - Cannot initiate connections (must be done in foreground)
**Heavy Processing** - CPU throttled, may cause crashes
**Camera/Photos** - Cannot access camera or photo library
**Screen Rendering** - UI doesn't update (use local notifications instead)
### System Throttling
**iOS aggressively throttles background apps:**
| Time in Background | GPS Accuracy | BLE Performance | CPU Quota |
|--------------------|--------------|-----------------|-----------|
| 0-10 seconds | Full | Full | 100% |
| 10 seconds - 3 minutes | Full | Full | 80% |
| 3-10 minutes | Reduced | Full | 50% |
| 10+ minutes | Deferred | Throttled | 20% |
| 30+ minutes | Significant deferral | Slow | 10% |
**Mitigation:**
- Keep BLE data payloads small
- Batch location broadcasts (don't send every update)
- Use background tasks for non-critical work
---
## Testing Background Execution
### 1. Xcode Console Monitoring
```bash
# Open Console.app and filter by your app
# Look for debug prints with timestamps
# Expected logs when backgrounded:
📍 [BackgroundLocation] New position: 37.7749, -122.4194
📤 [BackgroundLocation] Updating device location...
📡 [BackgroundLocation] Broadcasting self advertisement...
[BackgroundLocation] Location update sent successfully
```
### 2. Xcode Debug Navigator
1. Run app from Xcode
2. Press Home button to background app
3. In Xcode: Debug → View Debugging → Background Tasks
4. Verify "location" task is active
### 3. Background Simulation
```bash
# Simulate location changes in Simulator
xcrun simctl location <device-id> set 37.7749 -122.4194
# Simulate BLE data (requires real device)
# Send data via nRF Connect or LightBlue
```
### 4. Real-World Testing
**Recommended test procedure:**
1. Start app in foreground
2. Connect to MeshCore device
3. Start location tracking
4. **Lock screen** (simulates background)
5. Walk 50+ meters
6. Unlock and check:
- Location updates in logs
- Mesh broadcasts sent
- Battery usage acceptable
**Important:** iOS treats locked screen differently than backgrounded app!
- Locked = Full background capabilities
- Backgrounded (app switcher) = Throttled after 3 minutes
- Terminated = No background execution (must use background fetch)
---
## User-Facing Settings
### Recommended Settings Screen
```dart
class BackgroundTrackingSettings extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
children: [
SwitchListTile(
title: Text('Background Location Tracking'),
subtitle: Text('Keep tracking your location when app is closed'),
value: _isEnabled,
onChanged: (enabled) {
if (enabled) {
_startBackgroundTracking();
} else {
_stopBackgroundTracking();
}
},
),
ListTile(
title: Text('Update Distance'),
subtitle: Text('Send location update every $_distance meters'),
trailing: Text('$_distance m'),
onTap: () => _showDistanceSlider(),
),
ListTile(
title: Text('Battery Impact'),
subtitle: Text(_getBatteryImpactText()),
trailing: Icon(_getBatteryIcon()),
),
// Permission check
if (!_hasAlwaysPermission)
ListTile(
title: Text('⚠️ Permission Required'),
subtitle: Text('Tap to enable "Always Allow" location access'),
onTap: () => Geolocator.openLocationSettings(),
),
],
);
}
}
```
### Battery Impact Indicators
```dart
String _getBatteryImpactText() {
if (_distance <= 5) return 'High - Frequent updates';
if (_distance <= 20) return 'Medium - Balanced';
if (_distance <= 50) return 'Low - Sparse updates';
return 'Minimal - Only major movements';
}
IconData _getBatteryIcon() {
if (_distance <= 5) return Icons.battery_alert;
if (_distance <= 20) return Icons.battery_std;
return Icons.battery_full;
}
```
---
## Troubleshooting
### Location Updates Stop After 10 Minutes
**Symptom:** GPS stops updating after app is backgrounded for ~10 minutes
**Cause:** iOS defers location updates to save battery
**Solution:**
```dart
// Request "Always" permission (not just "When In Use")
await Geolocator.requestPermission();
// In Info.plist, ensure you have:
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Your explanation here</string>
// Use smaller distance filter to signal importance
LocationSettings(
accuracy: LocationAccuracy.best,
distanceFilter: 5, // smaller = less deferral
)
```
### BLE Connection Drops in Background
**Symptom:** BLE device disconnects after ~30 seconds in background
**Cause:** iOS terminates idle BLE connections to save power
**Solution:**
```dart
// Keep connection alive by polling
Timer.periodic(Duration(seconds: 20), (timer) async {
if (device.isConnected) {
// Read a characteristic to keep connection alive
await characteristic.read();
}
});
// Or send keepalive messages
Timer.periodic(Duration(seconds: 30), (timer) async {
if (device.isConnected) {
await bleService.sendSelfAdvert(floodMode: false);
}
});
```
**Current implementation:**
- Keepalive timer reads TX characteristic every 20 seconds ([meshcore_ble_service.dart:648-677](../lib/services/meshcore_ble_service.dart#L648-L677))
- Location updates also keep connection alive ([background_location_service.dart:112-121](../lib/services/background_location_service.dart#L112-L121))
- Timer automatically starts when connected, stops when disconnected
- Logs connection health: "💚 [BLE] Keepalive: Connection maintained"
### Blue Status Bar Annoying Users
**Symptom:** Users complain about persistent blue "using location" banner
**Explanation:** This is **intentional** iOS behavior for user privacy
**Options:**
1. **Keep it** - Shows app is working, builds trust
2. **Educate users** - Explain it's a safety feature
3. **Toggle option** - Let users disable background tracking if not in active SAR operation
**DO NOT try to hide it** - This is an Apple HIG violation and will get your app rejected
### Notifications Not Appearing in Background
**Symptom:** Local notifications don't show when app is backgrounded
**Cause:** Permission not granted or critical alerts not enabled
**Solution:**
```dart
// Request critical notification permission (bypasses silent mode)
await IOSFlutterLocalNotificationsPlugin().requestPermissions(
alert: true,
badge: true,
sound: true,
critical: true, // Important for SAR alerts
);
```
**Current implementation:** Already configured ([notification_service.dart:92-99](../lib/services/notification_service.dart#L92-L99))
---
## Battery Optimization Recommendations
### 1. Adaptive Distance Thresholds
```dart
// Adjust based on movement speed
class AdaptiveLocationTracking {
double _distanceThreshold = 10.0;
void _adjustThreshold(Position position) {
// If moving fast (in vehicle), use larger threshold
if (position.speed > 5.0) { // 5 m/s = 18 km/h
_distanceThreshold = 50.0;
}
// If stationary, use very large threshold
else if (position.speed < 0.5) {
_distanceThreshold = 100.0;
}
// If walking, use small threshold
else {
_distanceThreshold = 10.0;
}
}
}
```
### 2. Time-Based Throttling
```dart
// Don't broadcast more than once per minute
DateTime? _lastBroadcast;
void _handleLocationUpdate(Position position) async {
final now = DateTime.now();
if (_lastBroadcast != null) {
final elapsed = now.difference(_lastBroadcast!);
if (elapsed < Duration(seconds: 60)) {
return; // Skip this update
}
}
await _broadcastLocation(position);
_lastBroadcast = now;
}
```
### 3. Operation Mode Profiles
```dart
enum OperationMode {
active, // Full tracking, 5m threshold, 30s min interval
standby, // Medium tracking, 20m threshold, 2m min interval
idle, // Sparse tracking, 100m threshold, 10m min interval
}
class LocationProfileManager {
void applyProfile(OperationMode mode) {
switch (mode) {
case OperationMode.active:
_distanceThreshold = 5.0;
_minTimeInterval = 30;
break;
case OperationMode.standby:
_distanceThreshold = 20.0;
_minTimeInterval = 120;
break;
case OperationMode.idle:
_distanceThreshold = 100.0;
_minTimeInterval = 600;
break;
}
}
}
```
---
## Summary
### ✅ Your App is Ready for Background Execution
**Current capabilities:**
- ✅ Location tracking in background
- ✅ BLE communication in background
- ✅ Background task scheduling (configured but not used)
- ✅ Background fetch (configured but not used)
- ✅ All required permissions in Info.plist
**What works now:**
1. User starts app → connects to MeshCore device
2. User enables location tracking → `BackgroundLocationService` starts
3. User backgrounds app → Location updates continue
4. GPS updates trigger → Mesh broadcasts sent via BLE
5. BLE notifications received → Messages processed, notifications shown
6. User returns to app → Full state restored
**Limitations:**
- BLE connection must be initiated in foreground
- Location updates may be deferred after 10+ minutes
- CPU/network throttled after 3 minutes in background
- Cannot scan for new BLE devices in background
**Battery life:**
- Current config: **Medium impact** (~10-15% battery per hour of active tracking)
- With optimizations: **Low-Medium impact** (~5-10% per hour)
- Comparable to navigation apps (Google Maps, Waze)
### Next Steps (Optional Enhancements)
1. **Add Operation Mode Profiles** - Let users choose Active/Standby/Idle mode
2. **Implement Adaptive Thresholds** - Adjust tracking based on speed
3. **Add Battery Monitoring** - Show real-time battery impact
4. **Background Fetch Integration** - Sync messages when app is terminated
5. **Keepalive Optimization** - Fine-tune BLE connection retention
---
## References
- [Apple Background Execution Guide](https://developer.apple.com/documentation/uikit/app_and_environment/scenes/preparing_your_ui_to_run_in_the_background)
- [iOS Location Background Mode](https://developer.apple.com/documentation/corelocation/getting_the_user_s_location/handling_location_events_in_the_background)
- [iOS Bluetooth Background Mode](https://developer.apple.com/library/archive/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothBackgroundProcessingForIOSApps/PerformingTasksWhileYourAppIsInTheBackground.html)
- [flutter_blue_plus Background Mode](https://pub.dev/packages/flutter_blue_plus#background-mode)
- [Geolocator Package](https://pub.dev/packages/geolocator)
- [Local Notifications Package](https://pub.dev/packages/flutter_local_notifications)
**Last Updated:** 2025-10-30
**App Version:** 48 (iOS build 48)

View File

@@ -1,304 +0,0 @@
# Slovenian WMS Layers - SAR Application Analysis
**Total Layers Found: 108**
## HIGH PRIORITY - Critical for SAR Operations
### Aerial Imagery & Base Maps (5 layers)
1. **pregledovalnik:DOF_2024** - Digital Orthophoto 2024 (Latest aerial imagery)
- **USE CASE**: Primary visual reference, current terrain conditions
- **ALREADY IMPLEMENTED** in the app
2. **pregledovalnik:DOF25** - Digital Orthophoto 25cm resolution
- **USE CASE**: High-resolution aerial imagery for detailed terrain analysis
3. **pregledovalnik:DOF_IR** - Infrared Orthophoto
- **USE CASE**: Thermal/infrared imagery for detecting heat signatures, useful for night searches
4. **pregledovalnik:DTK25** - Topographic Map 1:25,000
- **USE CASE**: Traditional topographic reference with contours, trails, landmarks
5. **pregledovalnik:dof025_2022_2024** - Combined orthophoto 2022-2024
- **USE CASE**: Multi-year aerial imagery comparison
### Administrative Boundaries (6 layers)
6. **pregledovalnik:NEP_RPE_OBCINE** - Municipalities (občine)
- **USE CASE**: Jurisdiction boundaries for coordinating with local authorities
- **RECOMMENDED FOR OVERLAY**
7. **pregledovalnik:NEP_RPE_NASELJA** - Settlements
- **USE CASE**: Identify populated areas, evacuation points, staging areas
- **RECOMMENDED FOR OVERLAY**
8. **pregledovalnik:NEP_HISNE_STEVILKE** - House Numbers
- **USE CASE**: Precise location identification for emergency response
9. **pregledovalnik:NEP_RPE_UPRAVNE_ENOTE** - Administrative Units
- **USE CASE**: Regional administration boundaries
10. **pregledovalnik:NEP_RPE_STATISTICNE_REGIJE** - Statistical Regions
- **USE CASE**: Broader regional planning
11. **pregledovalnik:drzavna_meja** - State Border
- **USE CASE**: International coordination for cross-border operations
### Roads & Transportation (4 layers)
12. **pregledovalnik:KGI_LINIJE_CESTE_G** - Roads
- **USE CASE**: Primary access routes, evacuation routes, vehicle navigation
- **HIGH PRIORITY OVERLAY**
13. **pregledovalnik:gozdne_ceste** - Forest Roads
- **USE CASE**: Access to remote forest areas, critical for SAR vehicles
- **HIGH PRIORITY OVERLAY**
14. **pregledovalnik:LINIJE_ZELEZNICE_G** - Railways
- **USE CASE**: Alternative access routes, landmarks, coordination with rail authorities
15. **pregledovalnik:KGI_LINIJE_PLANINSKE_POTI_G** - Mountain/Hiking Trails
- **USE CASE**: Common search areas, lost hiker routes, access to remote areas
- **HIGH PRIORITY OVERLAY**
### Fire & Emergency Hazards (5 layers)
16. **pregledovalnik:gozdni_pozari** - Forest Fires (historical)
- **USE CASE**: Historical fire locations, high-risk areas
- **RECOMMENDED FOR OVERLAY**
17. **pregledovalnik:pozarna_ogrozenost** - Fire Hazard/Risk Areas
- **USE CASE**: Identify high fire risk zones, plan safe evacuation routes
- **HIGH PRIORITY OVERLAY**
18. **pregledovalnik:pozarisce_goriski_kras** - Fire Site - Goriški Kras
- **USE CASE**: Specific fire hazard area in Karst region
19. **pregledovalnik:pozarisce_kras** - Fire Site - Kras
- **USE CASE**: Karst region fire zones
20. **pregledovalnik:protipozarne_preseke** - Firebreaks
- **USE CASE**: Fire containment lines, safe zones
### Geographic Names & Navigation (1 layer)
21. **pregledovalnik:zemljepisna_imena** - Geographic Names
- **USE CASE**: Place names for communication, location identification
- **RECOMMENDED FOR OVERLAY**
---
## MEDIUM PRIORITY - Useful for Planning & Context
### Protected Areas & Natural Features (9 layers)
22. **pregledovalnik:natura2000** - Natura 2000 Protected Areas
- **USE CASE**: Environmental restrictions, sensitive areas
23. **pregledovalnik:zavarovana_obmocja_poligoni** - Protected Areas (polygons)
- **USE CASE**: National parks, nature reserves, access restrictions
24. **pregledovalnik:zavarovana_obmocja_tocke** - Protected Areas (points)
- **USE CASE**: Point-based protected sites
25. **pregledovalnik:zavarovana_obmocja_conacija** - Protected Areas (zoning)
- **USE CASE**: Zoning within protected areas
26. **pregledovalnik:naravne_vrednote_poligoni** - Natural Heritage (polygons)
- **USE CASE**: Notable natural features, landmarks
27. **pregledovalnik:naravne_vrednote_tocke** - Natural Heritage (points)
- **USE CASE**: Specific natural landmarks (caves, waterfalls, etc.)
28. **pregledovalnik:epo_poligoni** - Single Trees/Monuments (polygons)
- **USE CASE**: Notable landmark trees
29. **pregledovalnik:epo_tocke** - Single Trees/Monuments (points)
- **USE CASE**: Point landmarks
30. **pregledovalnik:gozdni_rezervati** - Forest Reserves
- **USE CASE**: Old-growth forests, restricted access areas
### Cadastral & Land Parcels (2 layers)
31. **pregledovalnik:kn_parcele** - Cadastral Parcels
- **USE CASE**: Land ownership boundaries, legal jurisdictions
32. **pregledovalnik:KN_KATASTRSKE_OBCINE** - Cadastral Municipalities
- **USE CASE**: Cadastral administrative units
### Terrain & Elevation (2 layers)
33. **pregledovalnik:DMK** - Digital Cartographic Model
- **USE CASE**: Contours, terrain features, elevation data
34. **pregledovalnik:DMR** - Digital Relief Model
- **USE CASE**: Shaded relief, terrain visualization
### Forest Management Areas (10 layers)
35. **pregledovalnik:gge** - Forest Management Units (GGE)
- **USE CASE**: Forest administrative units, contact local foresters
36. **pregledovalnik:ggo** - Forest Management Districts (GGO)
- **USE CASE**: Larger forest districts
37. **pregledovalnik:revirji** - Forest Ranger Districts
- **USE CASE**: Local ranger contact areas
38. **pregledovalnik:krajevne_enote** - Local Forest Units
- **USE CASE**: Smallest administrative forest units
39. **pregledovalnik:odseki** - Forest Compartments
- **USE CASE**: Forest subdivisions for management
40. **pregledovalnik:odseki_gozdni** - Forest Compartments (variant)
- **USE CASE**: Alternative compartment layer
41. **pregledovalnik:sestoji** - Forest Stands
- **USE CASE**: Specific tree stand types, vegetation density
42. **pregledovalnik:sestoji_druga_gozdna_zemljisca** - Other Forest Lands
- **USE CASE**: Non-productive forest areas
43. **pregledovalnik:varovalni_gozdovi** - Protection Forests
- **USE CASE**: Forests with protective function (avalanche, erosion)
44. **pregledovalnik:lovisca** - Hunting Grounds
- **USE CASE**: Contact with hunting associations for local knowledge
### Historical Disasters (6 layers)
45. **pregledovalnik:vetrolom_2017** - Windthrow 2017
- **USE CASE**: Storm damage areas, difficult terrain
46. **pregledovalnik:vetrolom_2018** - Windthrow 2018
- **USE CASE**: Storm damage areas from 2018
47. **pregledovalnik:zled_2014** - Ice Storm 2014
- **USE CASE**: Ice damage areas
48. **pregledovalnik:zled_drugi_gozdovi_2014** - Ice Storm 2014 (other forests)
- **USE CASE**: Ice damage in secondary forests
49. **pregledovalnik:podlubniki_2015_2019** - Bark Beetle Damage 2015-2019
- **USE CASE**: Dead wood areas, fire hazard, difficult terrain
50. **pregledovalnik:krcitve** - Clearcuts
- **USE CASE**: Open areas, recent harvest sites, potential staging areas
### Agricultural & Land Use (2 layers)
51. **pregledovalnik:povrsine_v_zarascanju** - Overgrown Areas
- **USE CASE**: Abandoned agricultural land, changing terrain
52. **pregledovalnik:skupna_kmetijska_politika_2023_2027** - Common Agricultural Policy
- **USE CASE**: Agricultural land use planning
---
## LOW PRIORITY - Technical/Specialized Layers
### Forest Function Layers (ON21 series - 45 layers)
These are highly specialized forest function layers from the 2021 forest management plan. Each has variants for lines (_l), polygons (_p), and points (_t):
**Categories:**
- **Biotska** (Biodiversity): on21_fun_biotska_l/p/t
- **Druge gozdne dobrine** (Other forest goods): on21_fun_druge_gozdne_dobrine_l/p/t
- **Estetska** (Aesthetic): on21_fun_estetska_l/p/t
- **Hidroloska** (Hydrological): on21_fun_hidroloska_l/p/t
- **Higiensko-zdravstvena** (Health/hygiene): on21_fun_higiensko_zdravstvena_p
- **Klimatska** (Climate): on21_fun_klimatska_l/p
- **Kulturna** (Cultural): on21_fun_kulturna_l/p/t
- **Lesnoproizvodna** (Timber production): on21_fun_lesnoproizvodna_p
- **Lovnogospodarska** (Hunting management): on21_fun_lovnogospodarska_p/t
- **Obrambna** (Defense): on21_fun_obrambna_p/t
- **Poucna** (Educational): on21_fun_poucna_l/p/t
- **Raziskovalna** (Research): on21_fun_raziskovalna_p/t
- **Rekreacijska** (Recreation): on21_fun_rekreacijska_l/p/t
- **Skupaj** (Combined): on21_fun_skupaj_l/p/t
- **Turisticna** (Tourism): on21_fun_turisticna_l/p/t
- **Varovalna** (Protection): on21_fun_varovalna_p
- **Varovanja naravnih vrednot** (Natural heritage protection): on21_fun_varovanja_naravnih_vrednot_l/p/t
- **Zascitna** (Conservation): on21_fun_zascitna_l/p
**USE CASE**: Very specialized forest planning data. May be useful for:
- **Rekreacijska**: Popular recreation areas (lost hikers)
- **Turisticna**: Tourist areas (search priority)
- **Varovalna**: Avalanche/erosion protection forests (hazard awareness)
### Miscellaneous Technical (6 layers)
- **pregledovalnik:conacija_gp** - Zonation (technical)
- **pregledovalnik:evrd** - Single-tree selection forests
- **pregledovalnik:koridorji** - Corridors (ecological)
- **pregledovalnik:luo** - Forest landscape units
- **pregledovalnik:pobude_gge** - GGE initiatives
- **pregledovalnik:provenience** - Seed provenance areas
- **pregledovalnik:uvhvvr** - High conservation value forests
- **pregledovalnik:gozdni_sklad_ekocelice** - Forest fund eco-cells
- **pregledovalnik:gozdni_sklad_habitatna_drevesa** - Habitat trees
### Layer Groups (2 layers)
- **pregledovalnik:ttn_group** - Group layer (container)
- **pregledovalnik:zemljevid_group** - Map group layer (container)
---
## RECOMMENDED IMPLEMENTATION PLAN
### Phase 1: Critical Overlays (Immediate)
Add these layers as toggleable overlays in the Map Options screen:
1. **Forest Roads** (`gozdne_ceste`) - PNG, transparent
- Critical for vehicle access in remote areas
2. **Hiking/Mountain Trails** (`KGI_LINIJE_PLANINSKE_POTI_G`) - PNG, transparent
- Common search areas for lost hikers
3. **Fire Hazard Zones** (`pozarna_ogrozenost`) - PNG, transparent
- Safety planning, risk assessment
4. **Settlements** (`NEP_RPE_NASELJA`) - PNG, transparent
- Populated areas, staging areas
5. **Municipalities** (`NEP_RPE_OBCINE`) - PNG, transparent
- Administrative boundaries
### Phase 2: Additional Useful Layers
6. **Geographic Names** (`zemljepisna_imena`)
7. **Forest Fires Historical** (`gozdni_pozari`)
8. **Protected Areas** (`zavarovana_obmocja_poligoni`)
9. **Topographic Map** (`DTK25`) - Alternative base layer
10. **Infrared Imagery** (`DOF_IR`) - Alternative base layer
### Phase 3: Specialized Layers (On Demand)
11. **Windthrow/Disaster Areas** (for post-disaster operations)
12. **Recreation/Tourism Areas** (for prioritizing search areas)
13. **Protection Forests** (avalanche/erosion hazard awareness)
---
## TECHNICAL NOTES
### CRS Compatibility
- All layers from `prostor.zgs.gov.si` support **EPSG:3794** (Slovenian National Grid)
- The app already has the correct CRS implementation in `lib/utils/slovenian_crs.dart`
### Recommended Formats
- **Base Layers**: JPEG (better compression for imagery)
- **Overlays**: PNG with transparency=true (for stacking)
### Caching Strategy
- All layers should use the existing FMTC caching infrastructure
- 30-day validity is appropriate for most layers
- Consider longer validity for static layers (administrative boundaries)
### Performance Considerations
- Limit active overlays to 3-4 simultaneously to avoid performance issues
- Use appropriate zoom level restrictions (some layers only useful at close zoom)
- Consider pre-downloading critical layers for offline SAR operations
---
## LAYER NAMING CONVENTIONS
**Slovenian Terms Reference:**
- **DOF** = Digitalni Ortofoto (Digital Orthophoto)
- **DTK** = Državna Topografska Karta (State Topographic Map)
- **DMK** = Digitalni Kartografski Model (Digital Cartographic Model)
- **DMR** = Digitalni Model Reliefa (Digital Relief Model)
- **NEP** = Nacionalni Evidenčni Portal (National Registry Portal)
- **RPE** = Register Prostorskih Enot (Spatial Units Register)
- **GGE** = Gozdnogospodarska Enota (Forest Management Unit)
- **GGO** = Gozdnogospodarska Območje (Forest Management District)
- **ON21** = Območni Načrt 2021 (Regional Plan 2021)