diff --git a/app/lib/server_requests/init_state.dart b/app/lib/server_requests/init_state.dart
index ce522506b938ab969c8cb88bb819c32035f3e6ba..590191e64fa3c52215ccfe1afb01893534394957 100644
--- a/app/lib/server_requests/init_state.dart
+++ b/app/lib/server_requests/init_state.dart
@@ -93,4 +93,4 @@ Future<void> initSearchOptions() async {
 Future<void> setLastLake() async {
   final prefs = await SharedPreferences.getInstance();
   await prefs.setString('lastLake', selectedLake);
-}
\ No newline at end of file
+}
diff --git a/app/lib/widgets/main_layout.dart b/app/lib/widgets/main_layout.dart
index 32eac0f951eb6bb50d37ebeea1dcffb5ae03476f..80e31e63337cced588f6c9a8923b70eb8ce0213c 100644
--- a/app/lib/widgets/main_layout.dart
+++ b/app/lib/widgets/main_layout.dart
@@ -1,6 +1,9 @@
+import 'dart:io';
+import 'dart:convert';
 import 'dart:typed_data';
 import 'package:flutter/material.dart';
 import 'package:google_fonts/google_fonts.dart';
+import 'package:path_provider/path_provider.dart';
 import 'package:shared_preferences/shared_preferences.dart';
 
 import 'osm_layer.dart';
@@ -188,10 +191,12 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
                                           ),
                                           child: const Text("Export JSON"),
                                           onPressed: () {
-                                            Navigator.pop(context);
+                                            Navigator.of(context).pop();
+                                            // Show progress indicator
+                                            showProgressIndicator(context);
+
                                           },
                                         )
-                                        // Add more children here as needed
                                       ],
                                     ),
                                 ),
@@ -289,3 +294,64 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
   }
 }
 
+Future<void> _exportIceData() async {
+  final directory = await getExternalStorageDirectory();
+  final file = File('${directory?.path}/ice_data_$selectedLake.json');
+
+  // Convert JSON data to string
+  final jsonString = jsonEncode(selectedMarkerList);
+
+  // Write JSON data to file
+  await file.writeAsString(jsonString);
+}
+
+
+
+// Display a progress indicator while JSON data is being downloaded
+void showProgressIndicator(BuildContext context) {
+  BuildContext? dialogContext;
+
+  showDialog(
+    context: context,
+    builder: (BuildContext context) {
+      dialogContext = context;
+
+      return WillPopScope(
+        onWillPop: () async => false, // Prevent dialog from being closed by user
+        child: const AlertDialog(
+          content: Column(
+            mainAxisSize: MainAxisSize.min,
+            children: [
+              CircularProgressIndicator(), // Progress indicator
+              SizedBox(height: 20),
+              Text('Exporting JSON data...'),
+            ],
+          ),
+        ),
+      );
+    },
+  );
+
+  // Ensure that the progress indicator runs for at lest 1 second
+  // before exporting the data
+  Future.delayed(const Duration(milliseconds: 1000), () {
+    try {
+      _exportIceData();
+      ScaffoldMessenger.of(context).showSnackBar(
+        const SnackBar(content: Text('Downloaded ice data as JSON')),
+      );
+    } catch (e) {
+      ScaffoldMessenger.of(context).showSnackBar(
+        SnackBar(content: Text('Error exporting JSON data: $e')),
+      );
+    } finally {
+      if (dialogContext != null) {
+        // Add 2 second delay before closing the dialog
+        Future.delayed(const Duration(seconds: 2), () {
+          Navigator.of(dialogContext!).pop();
+        });
+      }
+    }
+  });
+}
+