-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathindex.html
More file actions
1500 lines (1333 loc) · 75.9 KB
/
Copy pathindex.html
File metadata and controls
1500 lines (1333 loc) · 75.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Global Variables -->
<script>
console.log(`[Timing] inline-script (page head) parsing at t=${Math.round(performance.now())}ms`);
window.amche = {};
window.amche.ENABLE_INTRO_CONTENT = false; // Set to true to enable intro content auto-loading
window.amche.MAPBOXGL_ACCESS_TOKEN = 'pk.eyJ1Ijoib3NtaW5kaWEiLCJhIjoiY202czRpbWdpMDNyZjJwczJqZXdkMGR1eSJ9.eQQf--msfqtZIamJN-KKVQ'; // Mapbox Token by OpenStreetMap India Community for amche.in under not for profit community use https://www.mapbox.com/nonprofit . Please replace token for other uses
window.amche.GOOGLE_ANALYTICS = 'G-FBVGZ4HJV0';
window.amche.DOMAIN_URL = 'amche.in';
window.amche.DEFAULT_ATLAS = 'config/index.atlas.json';
window.amche.LAYER_DEFAULTS = 'config/_defaults.json';
window.amche.MAPBOX_MAP_OPTIONS = {
container: 'map'
};
window.amche.geoip = null;
(async function () {
try {
const res = await fetch('https://cloudflare.com/cdn-cgi/trace');
const text = await res.text();
const data = {};
text.trim().split('\n').forEach(line => {
const eq = line.indexOf('=');
if (eq > 0) data[line.slice(0, eq)] = line.slice(eq + 1);
});
window.amche.geoip = { ip: data.ip || null, countryCode: data.loc || null, colo: data.colo || null };
} catch (e) {
window.amche.geoip = {};
}
})();
</script>
<title>amche.in - Interactive 3D Atlas</title>
<link rel="canonical" href="https://amche.in" />
<link rel="manifest" href="/manifest.json">
<!-- Favicon -->
<link rel="icon" href="assets/img/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="assets/img/icon-192x192.png">
<!--
SEO and Social Media Meta Tags
Customize this to ensure proper SEO for the application
-->
<meta name="keywords"
content="community mapping, community atlas, Goa maps, land use zones, cadastral maps, Goa construction sites, Goa coastal zones, CZMP, Survey of India, Goa terrain, Goa RDP, Goa hill slopes, interactive mapping, Goa community mapping, Goa land records, decentralized planning, masterplans, land records, land use zones, cadastral maps, construction sites, coastal zones, hill slopes, regional development plans, user contributed map annotations, human footprint, climate change, nasa data, worldview data" />
<meta name="description"
content="Explore and create various maps for free using this citizen maintained digital mapping resource. Made in Goa, for the world." />
<!-- Open Graph Meta Tags for Social Media -->
<meta property="og:title" content="amche.in - community map atlas" />
<meta property="og:description"
content="Explore free 3D maps from your local government and community. Run by citizen volunteers from Goa, India." />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://amche.in" />
<meta property="og:image" content="https://amche.in/assets/img/og_image.jpg" />
<meta property="og:site_name" content="amche.in" />
<meta property="og:locale" content="en_IN" />
<!-- Twitter Card Meta Tags -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="amche.in - Interactive 3D Atlas" />
<meta name="twitter:description"
content="A customizable and interactive 3D map explorer with various map layers from Government and open datasets like OpenStreetMap project. View landuse plans, parcels, administrative boundaries, natural hazards, protected areas, regulatory boundaries, street map features and more." />
<meta name="twitter:image" content="https://amche.in/assets/img/og_image.jpg" />
<!-- Progressive Web App Meta Tags -->
<meta name="theme-color" content="#000000">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="amche.in">
<link rel="preconnect" href="https://fonts.googleapis.com" crossorigin />
<link rel="preconnect" href="https://cdn.jsdelivr.net" />
<link rel="preload" as="style" onload="this.onload=null;this.rel='stylesheet'"
href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@600&display=swap">
<link rel="preload" as="style" onload="this.onload=null;this.rel='stylesheet'"
href="https://cdn.jsdelivr.net/npm/mapbox-gl@v3.28.0/dist/mapbox-gl.min.css">
<link rel="preload" as="style" onload="this.onload=null;this.rel='stylesheet'"
href="https://cdn.jsdelivr.net/npm/@mapbox/mapbox-gl-draw@1.5.0/dist/mapbox-gl-draw.css">
<link rel="preload" as="style" onload="this.onload=null;this.rel='stylesheet'"
href="https://cdn.jsdelivr.net/npm/@mapbox/mapbox-gl-draw@1.5.0/dist/mapbox-gl-draw.css">
<link rel="preload" as="style" onload="this.onload=null;this.rel='stylesheet'"
href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.19.1/cdn/themes/light.min.css">
<link rel="preload" as="style" onload="this.onload=null;this.rel='stylesheet'" href="css/styles.css">
<link rel="preload" as="style" onload="this.onload=null;this.rel='stylesheet'" href="css/layer-interactions.css">
<!-- Critical CSS - Loaded inline to prevent FOUC -->
<style>
/* Viewport height utility */
.full-viewport-height {
height: 100vh;
}
@supports (height: 100dvh) {
.full-viewport-height {
height: 100dvh;
}
}
/* Basic layout utilities */
.flex {
display: flex;
}
.flex-col {
flex-direction: column;
}
.flex-grow {
flex-grow: 1;
}
.flex-shrink-0 {
flex-shrink: 0;
}
.items-center {
align-items: center;
}
.justify-between {
justify-content: space-between;
}
.justify-start {
justify-content: flex-start;
}
.gap-2 {
gap: 0.5rem;
}
.gap-3 {
gap: 0.75rem;
}
.min-w-0 {
min-width: 0;
}
.relative {
position: relative;
}
.h-full {
height: 100%;
}
/* Header navigation */
.header-nav {
padding: 0.625rem 1rem;
height: 56px;
}
.bg-gray-900 {
background-color: #111827;
}
.text-white {
color: white;
}
.border-b {
border-bottom-width: 1px;
}
.border-gray-800 {
border-color: #1f2937;
}
/* Navigation brand */
.nav-brand {
height: 36px;
}
.nav-logo {
width: 28px;
height: 28px;
max-width: 28px;
max-height: 28px;
flex-shrink: 0;
object-fit: contain;
}
.nav-title {
font-size: 1.125rem;
line-height: 1.2;
white-space: nowrap;
font-weight: 600;
letter-spacing: -0.025em;
}
.rounded {
border-radius: 0.375rem;
}
/* Header controls */
.header-controls {
height: 36px;
}
.max-w-md {
max-width: 28rem;
}
/* Responsive adjustments */
@media (max-width: 640px) {
.header-nav {
padding: 0.5rem 0.75rem;
height: 52px;
}
.nav-logo {
width: 24px;
height: 24px;
max-width: 24px;
max-height: 24px;
}
.nav-brand {
height: 32px;
}
.sm\:gap-3 {
gap: 0.75rem;
}
.sm\:flex {
display: flex;
}
}
/* Loading spinner animation */
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
/* Prevent FOUC for elements hidden before Tailwind loads */
.hidden {
display: none !important;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
</style>
<!-- Application Scripts -->
<script defer src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script><!-- Tailwind CSS via CDN -->
<script defer src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js"></script><!-- Add jQuery -->
<script defer src="https://cdn.jsdelivr.net/npm/@turf/turf@7/turf.min.js"></script>
<!-- Turf.js for geospatial operations -->
<script defer src="https://cdn.jsdelivr.net/npm/mapbox-gl@v3.28.0/dist/mapbox-gl.min.js"></script>
<!-- Mapbox GL JS -->
<script defer src="https://cdn.jsdelivr.net/npm/@mapbox/mapbox-gl-draw@1.5.0/dist/mapbox-gl-draw.js"></script>
<!-- Mapbox GL Draw (for measure control) -->
<script defer src="https://cdn.jsdelivr.net/npm/marked@14.1.3/marked.min.js"></script><!-- Mapbox GL JS -->
<script>
// @mapbox/search-js-web captures `globalThis.fetch` into a module-scoped variable
// the moment it loads, so patching window.fetch AFTER it loads (e.g. from within
// js/map-search-control.js) has no effect - the library keeps calling the original.
// This must run synchronously before the deferred search-js script below so the
// library captures the patched version instead. It bypasses the suggest endpoint's
// network request only when window.amche.shouldBypassSearchSuggest() says so
// (raw coordinate input, handled locally instead of via the Mapbox search API).
(function () {
var originalFetch = window.fetch.bind(window);
window.fetch = function (input, init) {
var url = typeof input === 'string' ? input : (input && input.url);
if (url && url.indexOf('/search/searchbox/v1/suggest') !== -1 &&
window.amche.shouldBypassSearchSuggest && window.amche.shouldBypassSearchSuggest()) {
return Promise.resolve(new Response(JSON.stringify({ suggestions: [] }), {
status: 200,
headers: { 'Content-Type': 'application/json' }
}));
}
return originalFetch(input, init);
};
})();
</script>
<script defer src="https://cdn.jsdelivr.net/npm/@mapbox/search-js-web@1.6.0/dist/mapboxsearch.min.js"></script>
<!-- Mapbox Search JS -->
<script defer type="module"
src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.19.1/cdn/shoelace.min.js"></script>
<!-- Shoelace Components -->
<script defer type="module" src="js/index.js"></script>
</head>
<body class="flex flex-col full-viewport-height">
<!-- Loading Overlay -->
<div id="loading-overlay" style="
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #0f172a;
display: flex;
align-items: center;
justify-content: center;
z-index: 10000;
overflow-y: auto;
overflow-x: hidden;
padding: 20px 0;
">
<!-- Close Button (shown only when manually opened) -->
<button id="loading-overlay-close" style="
display: none;
position: fixed;
top: 20px;
right: 20px;
z-index: 10001;
background: none;
border: none;
color: rgba(255, 255, 255, 0.6);
font-size: 32px;
line-height: 1;
cursor: pointer;
transition: all 0.2s ease;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
" onmouseover="this.style.color='rgba(239, 68, 68, 0.9)'; this.style.transform='scale(1.1)'"
onmouseout="this.style.color='rgba(255, 255, 255, 0.6)'; this.style.transform='scale(1)'">×</button>
<!-- Animated Background -->
<div style="
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-image: url('https://raw.githubusercontent.com/publicmap/amche-atlas/refs/heads/dev/assets/img/og_image.jpg');
background-size: cover;
background-position: center;
opacity: 0.25;
animation: subtlePan 60s ease-in-out infinite;
"></div>
<!-- Content -->
<div style="
position: relative;
z-index: 1;
display: flex;
flex-direction: column;
align-items: center;
gap: 16px;
max-width: 900px;
width: 100%;
padding: 1rem;
">
<!-- Logo and Title -->
<div style="display: flex; align-items: center; gap: 12px;">
<img src="assets/img/icon-192x192.png" alt="amche.in" style="
width: 48px;
height: 48px;
border-radius: 10px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
">
<a href="#" id="splash-brand-link" style="
font-size: 1.5rem;
color: white;
font-weight: 700;
line-height: 1;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
text-decoration: none;
transition: opacity 0.2s;
" onmouseover="this.style.opacity='0.8'" onmouseout="this.style.opacity='1'">amche.in</a>
<a href="https://github.com/publicmap/amche-atlas/commits/dev" target="_blank" id="splash-dev-badge"
style="display: none; padding: 4px 8px; background-color: #d97706; font-size: 0.75rem; font-weight: 600; border-radius: 4px; text-decoration: none; color: inherit; transition: opacity 0.2s;"
onmouseover="this.style.opacity='0.8'" onmouseout="this.style.opacity='1'">DEV</a>
</div>
<!-- Description -->
<p style="
font-size: 0.8125rem;
color: #e5e7eb;
margin: 0;
line-height: 1.3;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
text-align: center;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
">Amche Atlas is a free digital library of public maps maintained by the <a
href="https://openstreetmap.in/" style="color: inherit;">OpenStreetMap India community</a> from Goa.
</p>
<!-- Info Links -->
<div
style="display: flex; gap: 6px; flex-wrap: wrap; align-items: center; justify-content: center; margin-top: 8px;">
<a href="https://github.com/publicmap/amche-goa" target="_blank" style="
display: inline-flex;
align-items: center;
gap: 4px;
padding: 4px 8px;
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
color: white;
text-decoration: none;
border-radius: 4px;
font-size: 0.75rem;
font-weight: 500;
transition: background 0.2s;
border: 1px solid rgba(255, 255, 255, 0.2);
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
" onmouseover="this.style.background='rgba(255, 255, 255, 0.2)'"
onmouseout="this.style.background='rgba(255, 255, 255, 0.1)'">
<svg style="width: 12px; height: 12px; flex-shrink: 0;" fill="currentColor" viewBox="0 0 24 24">
<path
d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
</svg>
Source Code
</a>
<a href="./privacy.html" target="_blank" style="
display: inline-flex;
align-items: center;
gap: 4px;
padding: 4px 8px;
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
color: white;
text-decoration: none;
border-radius: 4px;
font-size: 0.75rem;
font-weight: 500;
transition: background 0.2s;
border: 1px solid rgba(255, 255, 255, 0.2);
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
" onmouseover="this.style.background='rgba(255, 255, 255, 0.2)'"
onmouseout="this.style.background='rgba(255, 255, 255, 0.1)'">
<svg style="width: 12px; height: 12px; flex-shrink: 0;" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd"
d="M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z"
clip-rule="evenodd" />
</svg>
Privacy Policy
</a>
<button id="loading-install-button" style="
display: inline-flex;
align-items: center;
gap: 4px;
padding: 4px 8px;
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
color: white;
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 4px;
font-size: 0.75rem;
font-weight: 500;
cursor: pointer;
transition: background 0.2s;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
" onmouseover="this.style.background='rgba(255, 255, 255, 0.2)'"
onmouseout="this.style.background='rgba(255, 255, 255, 0.1)'">
<svg style="width: 12px; height: 12px; flex-shrink: 0;" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd"
d="M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm3.293-7.707a1 1 0 011.414 0L9 10.586V3a1 1 0 112 0v7.586l1.293-1.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z"
clip-rule="evenodd" />
</svg>
Install
<svg style="width: 10px; height: 10px; flex-shrink: 0;" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd"
d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
clip-rule="evenodd" />
</svg>
</button>
</div>
<!-- Splash Atlas Section: location detection + atlas selection -->
<div id="splash-atlas-section"
style="display: none; margin-top: 12px; width: 100%; max-width: 600px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;">
<div
style="background: rgba(15, 25, 45, 0.97); backdrop-filter: blur(10px); border-radius: 8px; border: 1px solid rgba(96, 165, 250, 0.35); padding: 16px;">
<!-- State 1: Detecting Location -->
<div id="splash-detecting-state" style="display: none;">
<div
style="display: flex; align-items: center; gap: 10px; color: #e5e7eb; font-size: 0.95rem; flex-wrap: wrap;">
<div
style="width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.2); border-top-color: #3b82f6; border-radius: 50%; animation: spin 1s linear infinite; flex-shrink: 0;">
</div>
<span style="flex: 1;">Please wait. Detecting user location</span>
</div>
</div>
<!-- State 2: Atlas Selection -->
<div id="splash-atlas-state" style="display: none;">
<div id="splash-located-text"
style="display: none; align-items: center; gap: 6px; color: #10b981; font-size: 0.85rem; margin-bottom: 10px;">
<svg style="width:14px;height:14px;flex-shrink:0;" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd"
d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
clip-rule="evenodd" />
</svg>
User located successfully
</div>
<div
style="display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: #e5e7eb; font-size: 0.95rem;">
<span>Loading map atlas of</span>
<span id="splash-atlas-name"
style="color: #3b82f6; font-weight: 700; font-size: 1rem;">Map</span>
<select id="splash-atlas-dropdown"
style="display: none; padding: 4px 8px; background: rgba(15,25,50,0.99); color: #e5e7eb; border: 1px solid rgba(96,165,250,0.3); border-radius: 5px; font-size: 0.9rem; font-weight: 600; cursor: pointer; font-family: inherit;">
</select>
<button id="splash-change-atlas-btn"
style="padding: 4px 12px; background: rgba(255,255,255,0.08); color: #d1d5db; border: 1px solid rgba(255,255,255,0.15); border-radius: 5px; font-size: 0.8rem; cursor: pointer; font-family: inherit;">Change</button>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
// Loading status text rotation with fade effect
(function () {
const loadingMessages = [
'Your atlas is loading',
'आमचो नकासो लोड जावपाक लागला'
];
let currentIndex = 0;
const textElement = document.getElementById('requested-map-status');
if (textElement) {
const intervalId = setInterval(function () {
// Only rotate if still loading
if (textElement.textContent === 'Map loaded - proceeding shortly...' ||
textElement.textContent === 'Auto-proceed cancelled') {
clearInterval(intervalId);
return;
}
// Fade out
textElement.style.opacity = '0';
// Wait for fade out, then change text and fade in
setTimeout(function () {
currentIndex = (currentIndex + 1) % loadingMessages.length;
textElement.textContent = loadingMessages[currentIndex];
textElement.style.opacity = '1';
}, 400);
}, 2000);
}
})();
// Loading screen install button handler
(function () {
const loadingInstallButton = document.getElementById('loading-install-button');
let deferredPrompt;
// Capture PWA install prompt
window.addEventListener('beforeinstallprompt', (e) => {
e.preventDefault();
deferredPrompt = e;
});
if (loadingInstallButton) {
loadingInstallButton.addEventListener('click', async function () {
const choice = confirm(
'Install Amche Atlas\n\n' +
'Choose your installation option:\n\n' +
'OK = Install as Web App (Works on all devices)\n' +
'Cancel = View Android App (Beta)\n'
);
if (choice) {
// Install PWA
if (deferredPrompt) {
deferredPrompt.prompt();
const { outcome } = await deferredPrompt.userChoice;
deferredPrompt = null;
} else {
alert('To install the web app:\n\n• On iOS: Tap the Share button and select "Add to Home Screen"\n• On Android: Tap the menu (⋮) and select "Install app" or "Add to Home Screen"');
}
} else {
// Android app
const userConfirmed = confirm(
'🚀 Amche Atlas Android App (Closed Beta)\n\n' +
'The Android app is currently in closed beta testing. We need testers!\n\n' +
'To request access:\n' +
'1. Join our WhatsApp group\n' +
'2. Request beta testing access\n\n' +
'Click OK to join the WhatsApp group, or Cancel to open the Play Store listing.'
);
if (userConfirmed) {
window.open('https://chat.whatsapp.com/BbzANbnXuekARMMSyeo6Pf', '_blank');
} else {
window.open('https://play.google.com/store/apps/details?id=in.amche', '_blank');
}
}
});
}
})();
// Startup path handler
(function () {
const hasURLSearchParams = window.location.search.length > 1;
const hasLocationHash = window.location.hash.length > 1;
// Parse location from hash if present
let hashLocation = null;
if (hasLocationHash && !hasURLSearchParams) {
const hash = window.location.hash.substring(1);
const parts = hash.split('/');
if (parts.length === 3) {
const zoom = parseFloat(parts[0]);
const lat = parseFloat(parts[1]);
const lng = parseFloat(parts[2]);
if (!isNaN(lat) && !isNaN(lng)) {
hashLocation = { lat, lng, zoom };
}
}
}
const hasURLParams = hasURLSearchParams || (hasLocationHash && !hashLocation);
const locationButton = document.getElementById('location-button');
const proceedButton = document.getElementById('proceed-button');
const requestedMapSection = document.getElementById('requested-map-section');
const requestedMapSpinner = document.getElementById('requested-map-spinner');
const requestedMapCheckmark = document.getElementById('requested-map-checkmark');
const requestedMapStatus = document.getElementById('requested-map-status');
const sectionFillAnimation = document.getElementById('section-fill-animation');
const cancelAutoProceedBtn = document.getElementById('cancel-auto-proceed-button');
const urlInfoContent = document.getElementById('url-info-content');
const startupMenu = document.getElementById('startup-menu');
const loadingOverlay = document.getElementById('loading-overlay');
let fillAnimationTimeout = null;
let autoProceedCancelled = false;
let ipLocation = null;
let userInteracted = false;
window.loadingStartupState = {
mode: hasURLParams ? 'url-params' : (hashLocation ? 'hash-location' : 'basepath'),
userLocation: hashLocation,
bestAtlas: null,
proceedNormally: false,
mapReady: false,
manualOverlayControl: hasURLParams
};
const loadingOverlayClose = document.getElementById('loading-overlay-close');
function onMapReady() {
if (requestedMapSpinner) {
requestedMapSpinner.style.display = 'none';
}
if (requestedMapCheckmark) {
requestedMapCheckmark.style.display = 'block';
}
window.loadingStartupState.mapReady = true;
if (autoProceedCancelled || userInteracted) {
return;
}
if (loadingOverlay) {
loadingOverlay.style.opacity = '0';
loadingOverlay.style.transition = 'opacity 0.3s ease';
setTimeout(() => {
loadingOverlay.style.display = 'none';
}, 300);
}
}
function cancelAutoProceed() {
autoProceedCancelled = true;
userInteracted = true;
if (fillAnimationTimeout) {
clearTimeout(fillAnimationTimeout);
fillAnimationTimeout = null;
}
if (sectionFillAnimation) {
sectionFillAnimation.style.transition = 'none';
sectionFillAnimation.style.width = '0%';
}
if (cancelAutoProceedBtn) {
cancelAutoProceedBtn.style.display = 'none';
}
}
function openLoadingScreen() {
if (loadingOverlay) {
loadingOverlay.style.display = 'flex';
loadingOverlay.style.opacity = '1';
userInteracted = true; // Prevent auto-close when manually opened
autoProceedCancelled = true;
// Show close button when manually opened
if (loadingOverlayClose) {
loadingOverlayClose.style.display = 'block';
}
}
}
function closeLoadingScreen() {
if (loadingOverlay) {
loadingOverlay.style.opacity = '0';
loadingOverlay.style.transition = 'opacity 0.3s ease';
setTimeout(() => {
loadingOverlay.style.display = 'none';
}, 300);
// Hide close button
if (loadingOverlayClose) {
loadingOverlayClose.style.display = 'none';
}
}
}
// Close button click handler
if (loadingOverlayClose) {
loadingOverlayClose.addEventListener('click', closeLoadingScreen);
}
// Expose functions globally
window.openLoadingScreen = openLoadingScreen;
window.closeLoadingScreen = closeLoadingScreen;
window.handleGeolocation = handleGeolocation;
window.handleIPLocationFallback = handleIPLocationFallback;
window.cancelAutoProceed = cancelAutoProceed;
async function handleGeolocation(showStatusMessages = true) {
// Don't override if user has made manual selections
if (window.loadingStartupState?.manualAtlasSelection ||
window.loadingStartupState?.manualLocationSelection) {
console.log('[LoadingOverlay] Skipping geolocation - user made manual selection');
return false;
}
if (showStatusMessages && requestedMapStatus) {
requestedMapStatus.textContent = 'Waiting for device location...';
}
try {
const position = await new Promise((resolve, reject) => {
navigator.geolocation.getCurrentPosition(resolve, reject, {
enableHighAccuracy: true,
timeout: 5000,
maximumAge: 0
});
});
// Check again before setting - user might have made selection while waiting
if (window.loadingStartupState?.manualAtlasSelection ||
window.loadingStartupState?.manualLocationSelection) {
console.log('[LoadingOverlay] Skipping geolocation result - user made manual selection');
return false;
}
window.loadingStartupState.userLocation = {
lat: position.coords.latitude,
lng: position.coords.longitude,
accuracy: position.coords.accuracy,
detectedAt: performance.now()
};
// Dedicated, never-overwritten-by-GeoIP marker of a real GPS fix,
// dispatched as an event too so map-init.js can react (re-center +
// offer a lock/default toggle) even if it's already past startup.
window.loadingStartupState.gpsFix = window.loadingStartupState.userLocation;
window.dispatchEvent(new CustomEvent('amche:gps-resolved', {
detail: { lat: position.coords.latitude, lng: position.coords.longitude }
}));
console.log(
`[GPS] User location detected at t=${Math.round(performance.now())}ms:`,
`${position.coords.latitude.toFixed(6)}, ${position.coords.longitude.toFixed(6)}`,
`(accuracy: ${Math.round(position.coords.accuracy)}m)`
);
if (showStatusMessages && requestedMapStatus) {
requestedMapStatus.innerHTML = `Detected device location: <a href="#${position.coords.latitude.toFixed(6)},${position.coords.longitude.toFixed(6)}" style="color: #60a5fa; text-decoration: underline;">${position.coords.latitude.toFixed(6)}, ${position.coords.longitude.toFixed(6)}</a>`;
// Automatically proceed with device location
setTimeout(() => {
if (requestedMapStatus) {
requestedMapStatus.textContent = 'Loading map...';
}
}, 1500);
}
return true;
} catch (error) {
console.warn('Geolocation error:', error);
return false;
}
}
async function handleIPLocationFallback() {
// Don't override if user has made manual selections
if (window.loadingStartupState?.manualAtlasSelection ||
window.loadingStartupState?.manualLocationSelection) {
console.log('[LoadingOverlay] Skipping IP location - user made manual selection');
return false;
}
if (requestedMapStatus) {
requestedMapStatus.innerHTML = 'Detecting user location from <a href="https://ipapi.co/json/" target="_blank" style="color: #60a5fa; text-decoration: underline;">IP</a>';
}
try {
const response = await fetch('https://ipapi.co/json/');
const data = await response.json();
ipLocation = {
lat: data.latitude,
lng: data.longitude,
city: data.city,
region: data.region,
country: data.country_name
};
// Expose immediately for splash screen UI
window.ipLocationData = ipLocation;
// Enrich geoip with coordinates and place info from ipapi
window.amche.geoip = {
...(window.amche.geoip || {}),
lat: data.latitude,
lng: data.longitude,
city: data.city,
region: data.region,
country: data.country_name,
countryCode: data.country_code || window.amche.geoip?.countryCode || null
};
if (requestedMapStatus) {
requestedMapStatus.innerHTML = `Detected IP location: <a href="https://ipapi.co/json/" target="_blank" style="color: #60a5fa; text-decoration: underline;">${ipLocation.city}, ${ipLocation.region}, ${ipLocation.country}</a>. <a href="#" id="use-device-location-link" style="color: #60a5fa; text-decoration: underline;">Use Device Location</a> for better accuracy`;
}
// Add event listener for device location link
setTimeout(() => {
const deviceLocationLink = document.getElementById('use-device-location-link');
if (deviceLocationLink) {
deviceLocationLink.addEventListener('click', async function (e) {
e.preventDefault();
await handleGeolocation();
});
}
}, 100);
// Automatically proceed with IP location after a short delay
// But only if user hasn't made manual selections
setTimeout(() => {
if (!window.loadingStartupState?.manualAtlasSelection &&
!window.loadingStartupState?.manualLocationSelection) {
window.loadingStartupState.userLocation = ipLocation;
if (requestedMapStatus) {
requestedMapStatus.textContent = 'Loading map...';
}
}
}, 300);
return true;
} catch (ipError) {
console.warn('IP location failed:', ipError);
if (requestedMapStatus) {
requestedMapStatus.textContent = 'Could not determine location';
}
return false;
}
}
window.addEventListener('mapReady', onMapReady);
// Add click handler to loading overlay to disable auto-close
loadingOverlay.addEventListener('click', function (e) {
// Don't disable auto-close if clicking on links or buttons
if (!e.target.closest('a') && !e.target.closest('button')) {
userInteracted = true;
autoProceedCancelled = true;
if (fillAnimationTimeout) {
clearTimeout(fillAnimationTimeout);
fillAnimationTimeout = null;
}
if (sectionFillAnimation) {
sectionFillAnimation.style.transition = 'none';
sectionFillAnimation.style.width = '0%';
}
}
});
if (hasURLParams) {
// Show URL info and cancel button for URL params
const urlParams = new URLSearchParams(window.location.search);
const atlas = urlParams.get('atlas');
const layers = urlParams.get('layers');
const terrain = urlParams.get('terrain');
const selected = urlParams.get('selected');
const hash = window.location.hash.substring(1);
let hashInfo = '';
if (hash) {
const parts = hash.split('/');
if (parts.length === 3) {
hashInfo = `Location: ${parts[2]}, ${parts[1]} (zoom ${parts[0]})`;
}
}
let infoHTML = '';
if (atlas) infoHTML += `Atlas: ${atlas.length > 50 ? atlas.substring(0, 50) + '...' : atlas}<br>`;
if (layers) {
const layerIds = layers.split(',').map(l => l.includes('{') ? 'custom' : l);
infoHTML += `Layers: ${layerIds.join(', ')}<br>`;
}
if (terrain) infoHTML += `3D Terrain: ${terrain}x<br>`;
if (selected) infoHTML += `Selected Features: ${selected.split(';').length} layer(s)<br>`;
if (hashInfo) infoHTML += hashInfo;
if (urlInfoContent) {
urlInfoContent.innerHTML = infoHTML || 'Custom map configuration';
urlInfoContent.style.display = 'block';
}
if (cancelAutoProceedBtn) {
cancelAutoProceedBtn.style.display = 'block';
cancelAutoProceedBtn.addEventListener('click', cancelAutoProceed);
}
// If there's a location hash, proceed normally with the URL
// If there's NO location hash, let SplashScreenManager handle location detection
if (hashInfo) {
window.loadingStartupState.proceedNormally = true;
} else {
// No location provided - SplashScreenManager will handle this
// Don't automatically trigger geolocation here
console.log('[LoadingOverlay] No location hash - letting SplashScreenManager control startup');
}
} else if (hashLocation) {
// Location hash detected - use coordinates from URL
if (urlInfoContent) {
urlInfoContent.style.display = 'none';
}
if (cancelAutoProceedBtn) {
cancelAutoProceedBtn.style.display = 'none';
}
requestedMapStatus.innerHTML = `Using location from URL: <a href="${window.location.href}" style="color: #60a5fa; text-decoration: underline;">${hashLocation.lat.toFixed(6)}, ${hashLocation.lng.toFixed(6)}</a>`;
// Automatically proceed with hash location
setTimeout(() => {
requestedMapStatus.textContent = 'Loading map...';
}, 1000);
} else {
// Hide URL info and cancel button for no URL params
if (urlInfoContent) {
urlInfoContent.style.display = 'none';
}
if (cancelAutoProceedBtn) {
cancelAutoProceedBtn.style.display = 'none';
}
// Let SplashScreenManager handle location detection
console.log('[LoadingOverlay] No URL params or hash - SplashScreenManager will control startup');
}
})();
</script>
<!-- Navigation Menu Overlay -->
<div id="nav-menu-overlay"
style="display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.5); z-index: 1000;">
<div id="nav-menu-container"
style="position: absolute; top: 0; right: 0; width: 360px; height: 100%; background: #1f2937; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); overflow-y: auto;">
<!-- Hero Header -->
<div
style="position: relative; padding: 2rem 1.25rem; border-bottom: 1px solid #374151; overflow: hidden; min-height: 200px;">
<div
style="position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-image: url('https://raw.githubusercontent.com/publicmap/amche-atlas/refs/heads/dev/assets/img/og_image.jpg'); background-size: cover; background-position: center; opacity: 0.25; animation: subtlePan 60s ease-in-out infinite;">
</div>
<div style="position: relative; z-index: 1;">
<div
style="display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1rem;">
<div style="display: flex; align-items: center; gap: 0.75rem;">
<img src="assets/img/icon-192x192.png" alt="amche.in"
style="width: 48px; height: 48px; border-radius: 10px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);">
<a href="#" id="nav-menu-brand-link"
style="font-size: 1.5rem; color: white; font-weight: 700; margin: 0; line-height: 1; text-decoration: none; display: block; transition: opacity 0.2s; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);"
onmouseover="this.style.opacity='0.8'" onmouseout="this.style.opacity='1'">amche.in</a>
</div>
<button id="nav-menu-close"
style="background: rgba(0, 0, 0, 0.4); border: none; color: white; font-size: 1.5rem; cursor: pointer; padding: 0.25rem 0.5rem; line-height: 1; border-radius: 4px; transition: background 0.2s;"
onmouseover="this.style.background='rgba(0, 0, 0, 0.6)'"
onmouseout="this.style.background='rgba(0, 0, 0, 0.4)'">×</button>
</div>