-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmap-creator.html
More file actions
673 lines (600 loc) · 30.5 KB
/
map-creator.html
File metadata and controls
673 lines (600 loc) · 30.5 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Create New Layer</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: #f9fafb;
}
.tab-button {
transition: all 0.2s ease;
}
.tab-button.active {
background: white;
border-bottom-color: transparent;
}
.tab-content {
display: none;
}
.tab-content.active {
display: block;
}
.preview-box {
max-height: 200px;
overflow-y: auto;
font-family: monospace;
font-size: 11px;
}
.color-picker-wrapper {
display: inline-block;
position: relative;
}
.color-preview {
width: 40px;
height: 40px;
border-radius: 4px;
border: 2px solid #d1d5db;
cursor: pointer;
}
input[type="color"] {
position: absolute;
opacity: 0;
width: 40px;
height: 40px;
cursor: pointer;
}
.section-box {
background: white;
border: 1px solid #e5e7eb;
border-radius: 8px;
padding: 16px;
margin-bottom: 16px;
}
.scrollbar-thin::-webkit-scrollbar {
width: 8px;
}
.scrollbar-thin::-webkit-scrollbar-track {
background: #f1f1f1;
}
.scrollbar-thin::-webkit-scrollbar-thumb {
background: #888;
border-radius: 4px;
}
.scrollbar-thin::-webkit-scrollbar-thumb:hover {
background: #555;
}
.format-chip,
.format-info {
position: relative;
}
.format-chip:active {
transform: scale(0.95);
}
.format-chip.active-format {
position: relative;
box-shadow: 0 0 0 2px currentColor;
font-weight: 600;
}
.format-chip.active-format::before {
content: '✓';
position: absolute;
top: -6px;
right: -6px;
background: white;
color: currentColor;
width: 18px;
height: 18px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
font-weight: bold;
border: 2px solid currentColor;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
z-index: 10;
}
.format-chip:not(.active-format):hover::after,
.format-info:hover::after {
content: attr(data-tooltip);
position: absolute;
bottom: 100%;
left: 0;
margin-bottom: 8px;
padding: 8px 12px;
background: #1f2937;
color: white;
font-size: 11px;
line-height: 1.4;
white-space: pre-line;
border-radius: 6px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
z-index: 1000;
width: 250px;
text-align: left;
pointer-events: none;
}
.format-chip:not(.active-format):hover::before,
.format-info:hover::before {
content: '';
position: absolute;
bottom: 100%;
left: 20px;
margin-bottom: 2px;
border: 6px solid transparent;
border-top-color: #1f2937;
z-index: 1000;
pointer-events: none;
}
.format-chip.active-format:hover::after {
content: attr(data-tooltip);
position: absolute;
bottom: 100%;
left: 0;
margin-bottom: 8px;
padding: 8px 12px;
background: #1f2937;
color: white;
width: 250px;
border-radius: 6px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
font-size: 11px;
line-height: 1.4;
white-space: pre-line;
text-align: left;
z-index: 1000;
pointer-events: none;
}
.format-chip:nth-child(n+4):hover::after {
left: auto;
right: 0;
}
.format-chip:nth-child(n+4):hover::before {
left: auto;
right: 20px;
}
.format-info:nth-last-child(1):hover::after {
left: auto;
right: 0;
}
.format-info:nth-last-child(1):hover::before {
left: auto;
right: 20px;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
.animate-spin {
animation: spin 1s linear infinite;
}
</style>
</head>
<body>
<div class="flex flex-col h-screen">
<!-- Header -->
<div class="bg-gray-900 text-white px-4 py-3 border-b border-gray-700 flex items-center justify-between">
<div class="flex items-center gap-2">
<button id="back-btn" class="text-white hover:text-gray-300" title="Back to browser">
← Back
</button>
<h1 class="text-lg font-bold">Create New Map Layer</h1>
</div>
<button id="close-btn" class="text-white hover:text-gray-300 text-2xl leading-none">×</button>
</div>
<!-- Content -->
<div class="flex-1 overflow-y-auto scrollbar-thin p-4">
<!-- Section 1: Load Data -->
<div class="section-box">
<h2 class="text-md font-bold mb-3">1. Load Data</h2>
<!-- Tabs -->
<div class="flex border-b border-gray-300 mb-4">
<button class="tab-button px-4 py-2 font-medium active" data-tab="url">Import from URL</button>
<button class="tab-button px-4 py-2 font-medium" data-tab="upload">Upload File</button>
</div>
<!-- Tab: Import from URL -->
<div class="tab-content active" id="tab-url">
<div class="relative mb-2">
<input type="text" id="url-input"
placeholder="Enter URL to GeoJSON, CSV, KML, Vector tiles, Raster tiles, or MapWarper"
class="w-full px-3 py-2 pr-20 border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500">
<div class="absolute right-2 top-1/2 transform -translate-y-1/2 flex items-center gap-2">
<span id="url-validation" class="text-xs"></span>
<button type="button" id="clear-url-btn" class="text-gray-400 hover:text-gray-600 hidden"
title="Clear">
✕
</button>
</div>
</div>
<div class="text-xs text-gray-600 mb-2">
Supported formats (click to try example):
</div>
<div class="flex flex-wrap gap-2">
<button type="button"
class="format-chip px-2 py-1 bg-blue-100 hover:bg-blue-200 text-blue-800 rounded text-xs font-medium cursor-pointer transition-colors"
data-format="geojson"
data-sample="https://gist.githubusercontent.com/planemad/e5ccc47bf2a1aa458a86d6839476f539/raw/goa-water-bodies.geojson"
data-tooltip="📍 GeoJSON
Vector features in JSON format
Supports: Points, Lines, Polygons
URL format: .geojson or .json
Click to try example URL">
GeoJSON
</button>
<button type="button"
class="format-chip px-2 py-1 bg-green-100 hover:bg-green-200 text-green-800 rounded text-xs font-medium cursor-pointer transition-colors"
data-format="csv"
data-sample="https://docs.google.com/spreadsheets/d/e/2PACX-1vRhTXMFezW8k996di0qKP7-9-0ro0djuEEtMPYDOMhXtNOiUK_25lv90AThy21X2PRPYI_st93CQVq2/pub?gid=1432085196&single=true&output=csv"
data-tooltip="📊 CSV (Tabular Data)
Point data with lat/lng columns
Supports: Google Sheets, .csv files
URL format: .csv or output=csv
Click to try Google Sheets example">
CSV
</button>
<button type="button"
class="format-chip px-2 py-1 bg-purple-100 hover:bg-purple-200 text-purple-800 rounded text-xs font-medium cursor-pointer transition-colors"
data-format="kml"
data-sample="https://files.worldwind.arc.nasa.gov/artifactory/web/0.9.0/examples/data/KML_Samples.kml"
data-tooltip="🌍 KML (Google Earth)
Keyhole Markup Language format
Supports: Points, Lines, Polygons
URL format: .kml files
Click to try NASA KML samples">
KML
</button>
<button type="button"
class="format-chip px-2 py-1 bg-orange-100 hover:bg-orange-200 text-orange-800 rounded text-xs font-medium cursor-pointer transition-colors"
data-format="vector-tiles"
data-sample="https://tiles.stadiamaps.com/data/openmaptiles/{z}/{x}/{y}.pbf" data-tooltip="🔷 Vector Tiles
Tiled vector data (.pbf/.mvt)
High performance for large datasets
URL format: {z}/{x}/{y}.pbf
Click to try Stadia Maps example">
Vector Tiles
</button>
<button type="button"
class="format-chip px-2 py-1 bg-yellow-100 hover:bg-yellow-200 text-yellow-800 rounded text-xs font-medium cursor-pointer transition-colors"
data-format="raster-tiles" data-sample="https://tile.openstreetmap.org/{z}/{x}/{y}.png"
data-tooltip="🗺️ Raster Tiles (TMS/XYZ)
Tiled images (satellite, maps)
Standard web map tiles
URL format: {z}/{x}/{y}.png
Click to try OpenStreetMap example">
Raster Tiles
</button>
<button type="button"
class="format-chip px-2 py-1 bg-red-100 hover:bg-red-200 text-red-800 rounded text-xs font-medium cursor-pointer transition-colors"
data-format="mapwarper" data-sample="https://mapwarper.net/maps/95676" data-tooltip="🗺️ MapWarper
Georeferenced historic maps
Hosted on mapwarper.net
URL format: mapwarper.net/maps/[ID]
Click to try example map">
MapWarper
</button>
<button type="button"
class="format-chip px-2 py-1 bg-indigo-100 hover:bg-indigo-200 text-indigo-800 rounded text-xs font-medium cursor-pointer transition-colors"
data-format="wms"
data-sample="http://14.139.123.73:8080/geoserver/wms?service=WMS&version=1.3.0&request=GetMap&layers=nbss_geoserver:Goa_LUP&styles=&format=image/png&transparent=true"
data-tooltip="🌐 WMS (Web Map Service)
OGC Web Map Service
Supports WMS 1.1.1 and 1.3.0
URL format: GetMap request URL
Click to try GeoServer example">
WMS
</button>
<button type="button"
class="format-chip px-2 py-1 bg-teal-100 hover:bg-teal-200 text-teal-800 rounded text-xs font-medium cursor-pointer transition-colors"
data-format="atlas-json" data-sample="https://jsonkeeper.com/b/E576V" data-tooltip="📋 Amche Atlas JSON
Complete layer configuration
Hosted on jsonkeeper.com or any JSON URL
URL format: .json or jsonkeeper.com/b/[ID]
Click to try JSONKeeper example">
Amche Atlas JSON
</button>
</div>
</div>
<!-- Tab: Upload File -->
<div class="tab-content" id="tab-upload">
<input type="file" id="file-input" accept=".csv,.geojson,.json,.kml,.tif,.tiff,.png,.jpg,.jpeg"
class="w-full px-3 py-2 border border-gray-300 rounded mb-2">
<!-- Georeferencing Notice (for image files) -->
<div id="georef-notice" class="hidden mb-3 p-4 bg-yellow-50 border border-yellow-200 rounded-lg">
<div class="flex items-start gap-3">
<svg class="w-6 h-6 text-yellow-600 flex-shrink-0" fill="none" stroke="currentColor"
viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z">
</path>
</svg>
<div class="flex-1">
<h4 class="font-semibold text-yellow-800 mb-1">Map image lacks georeferencing
information</h4>
<p class="text-sm text-yellow-700 mb-3">
<a href="https://mapwarper.net/maps/new" target="_blank"
class="font-medium underline hover:text-yellow-900">Upload your map to
mapwarper.net</a> first (free signup) to georeference the image with matching
map control points. After rectification, import the mapwarper URL into Amche
Atlas.
</p>
<div class="text-sm">
<strong class="text-yellow-800">Help resources:</strong>
<ul class="mt-1 space-y-1 text-yellow-700">
<li>
📖 <a
href="https://programminghistorian.org/en/lessons/introduction-map-warper"
target="_blank" class="underline hover:text-yellow-900">Introduction to
Map Warper Tutorial</a>
</li>
<li>
🎥 <a href="https://www.youtube.com/watch?v=EIZj67YgOXE" target="_blank"
class="underline hover:text-yellow-900">Video Tutorial on YouTube</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="text-xs text-gray-600 mb-2">
Supported formats (hover for details):
</div>
<div class="flex flex-wrap gap-2">
<span class="format-info px-2 py-1 bg-green-100 text-green-800 rounded text-xs font-medium"
data-tooltip="📊 CSV Files
Tabular data with lat/lng columns
Column names: lat, latitude, lng, longitude
Accepted: .csv files
Select a CSV file to upload">
CSV
</span>
<span class="format-info px-2 py-1 bg-blue-100 text-blue-800 rounded text-xs font-medium"
data-tooltip="📍 GeoJSON Files
Vector features in JSON format
Supports: Points, Lines, Polygons
Accepted: .geojson, .json files
Select a GeoJSON file to upload">
GeoJSON
</span>
<span class="format-info px-2 py-1 bg-purple-100 text-purple-800 rounded text-xs font-medium"
data-tooltip="🌍 KML Files
Google Earth format
Supports: Points, Lines, Polygons
Accepted: .kml files
Select a KML file to upload">
KML
</span>
</div>
</div>
<button id="load-data-btn"
class="w-full mt-4 px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700">
Load Data
</button>
<!-- Data Preview (GeoJSON only) -->
<details class="mt-4" id="data-preview-details" style="display: none;">
<summary class="cursor-pointer text-sm font-medium text-gray-700 hover:text-gray-900 py-2">
<span id="preview-summary">Data Preview</span>
</summary>
<div class="mt-2">
<textarea id="geojson-editor" rows="10"
placeholder='{"type": "FeatureCollection", "features": []}'
class="w-full px-3 py-2 border border-gray-300 rounded font-mono text-xs mb-2"></textarea>
<div class="flex gap-2">
<button type="button" id="preview-geojson-io-btn"
class="flex-1 px-4 py-2 bg-white border border-gray-300 text-gray-700 rounded hover:bg-gray-50 flex items-center justify-center gap-2">
<span>↗</span> Preview in GeoJSON.io
</button>
<button type="button" id="download-geojson-btn"
class="flex-1 px-4 py-2 bg-white border border-gray-300 text-gray-700 rounded hover:bg-gray-50 flex items-center justify-center gap-2">
<span>⬇</span> Download GeoJSON
</button>
</div>
</div>
</details>
</div>
<!-- Section 2: Layer Settings -->
<div class="section-box" id="settings-section" style="display: none;">
<h2 class="text-md font-bold mb-3">2. Layer Settings</h2>
<!-- Layer Info Section -->
<div>
<h3 class="text-sm font-semibold mb-3">Layer Info</h3>
<div class="mb-4">
<label class="block text-sm font-medium mb-2">Title *</label>
<input type="text" id="layer-title" placeholder="My Custom Layer"
class="w-full px-3 py-2 border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div class="mb-4">
<label class="block text-sm font-medium mb-2">ID *</label>
<input type="text" id="layer-id" placeholder="my-custom-layer-01"
class="w-full px-3 py-2 border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 font-mono text-sm">
<div class="text-xs text-gray-500 mt-1">Unique identifier for this layer (auto-generated from
title)</div>
</div>
<div class="mb-4">
<label class="block text-sm font-medium mb-2">Type *</label>
<select id="layer-type"
class="w-full px-3 py-2 border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="geojson">GeoJSON - Vector features in JSON format</option>
<option value="csv">CSV - Tabular data with lat/lng columns</option>
<option value="vector">Vector Tiles - Tiled vector data (.pbf/.mvt)</option>
<option value="tms">Raster Tiles - Tiled images (TMS/XYZ)</option>
<option value="style">Style - Uses existing Mapbox style sources</option>
<option value="atlas">Atlas - Atlas configuration</option>
</select>
<div class="text-xs text-gray-500 mt-1">Data format type (auto-detected from source)</div>
</div>
<div class="mb-4">
<label class="block text-sm font-medium mb-2">Description</label>
<textarea id="layer-description" rows="2" placeholder="Optional description"
class="w-full px-3 py-2 border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500"></textarea>
</div>
<div class="mb-4" id="data-fields-section" style="display: none;">
<h4 class="text-sm font-semibold mb-3">Data Fields</h4>
<div id="csv-coordinate-fields" class="mb-4 pb-4 border-b border-gray-200" style="display: none;">
<div class="mb-3">
<label class="block text-xs font-medium mb-1">
Latitude Field <span class="text-red-500">*</span>
</label>
<select id="csv-latitude-field"
class="w-full px-3 py-2 border border-gray-300 rounded text-sm">
<option value="">Auto-detect or select...</option>
</select>
<div class="text-xs text-gray-500 mt-1">
Column with latitude values (e.g., Lat, Y, Latitude)
</div>
</div>
<div class="mb-3">
<label class="block text-xs font-medium mb-1">
Longitude Field <span class="text-red-500">*</span>
</label>
<select id="csv-longitude-field"
class="w-full px-3 py-2 border border-gray-300 rounded text-sm">
<option value="">Auto-detect or select...</option>
</select>
<div class="text-xs text-gray-500 mt-1">
Column with longitude values (e.g., Long, X, Longitude)
</div>
</div>
</div>
<div class="mb-3">
<label class="block text-xs font-medium mb-1">Feature ID</label>
<select id="feature-id-field"
class="w-full px-3 py-2 border border-gray-300 rounded text-sm">
<option value="">Select field...</option>
</select>
</div>
<div class="mb-3">
<label class="block text-xs font-medium mb-1">Feature Name</label>
<select id="feature-name-field"
class="w-full px-3 py-2 border border-gray-300 rounded text-sm">
<option value="">Select field...</option>
</select>
</div>
<details class="mb-3">
<summary class="cursor-pointer text-xs font-medium text-gray-700 hover:text-gray-900 py-2">
Inspect Fields
</summary>
<div class="mt-2 max-h-48 overflow-y-auto border border-gray-200 rounded p-2">
<div id="inspect-fields-list" class="space-y-1"></div>
</div>
</details>
</div>
</div>
<!-- Style Section -->
<div id="style-controls" class="mt-4 pt-4 border-t border-gray-200">
<h3 class="text-sm font-semibold mb-3">Style</h3>
<div id="geometry-type-info" class="mb-3 text-xs text-gray-600"></div>
<!-- Fill Color (for polygons/points) -->
<div class="mb-4" id="fill-color-control">
<label class="block text-sm font-medium mb-2">Fill Color</label>
<div class="color-picker-wrapper">
<input type="color" id="fill-color" value="#3b82f6">
<div class="color-preview" id="fill-color-preview" style="background-color: #3b82f6;"></div>
</div>
</div>
<!-- Stroke Color (for lines/polygons) -->
<div class="mb-4" id="stroke-color-control">
<label class="block text-sm font-medium mb-2">Stroke Color</label>
<div class="color-picker-wrapper">
<input type="color" id="stroke-color" value="#1e40af">
<div class="color-preview" id="stroke-color-preview" style="background-color: #1e40af;">
</div>
</div>
</div>
<!-- Stroke Width (for lines/polygons) -->
<div class="mb-4" id="stroke-width-control">
<label class="block text-sm font-medium mb-2">
Stroke Width: <span id="stroke-width-value">2</span>px
</label>
<input type="range" id="stroke-width" min="1" max="10" value="2" step="0.5" class="w-full">
</div>
</div>
<!-- Configuration JSON Section -->
<div class="mt-4 pt-4 border-t border-gray-200">
<div class="mb-4">
<label class="block text-sm font-medium mb-2">Configuration JSON</label>
<textarea id="config-preview" rows="8" readonly
class="w-full px-3 py-2 border border-gray-300 rounded bg-gray-50 font-mono text-xs mb-2"></textarea>
<details class="mt-2">
<summary class="cursor-pointer text-xs font-medium text-gray-700 hover:text-gray-900 py-2">
How to use this layer configuration
</summary>
<div class="mt-2 text-xs space-y-3 text-gray-600">
<div>
<strong>1. Use inline as URL parameter:</strong>
<div class="mt-1 flex gap-2">
<input type="text" id="inline-url" readonly
class="flex-1 px-2 py-1 bg-gray-50 border border-gray-300 rounded text-xs font-mono">
<button type="button" id="copy-inline-btn"
class="px-3 py-1 bg-blue-600 text-white rounded hover:bg-blue-700 text-xs">
Copy
</button>
</div>
</div>
<div>
<strong>2. Store as remote JSON and load via URL:</strong>
<div class="mt-1">
<code class="text-xs">?layers=https://jsonkeeper.com/b/YOUR_ID</code>
</div>
<div class="mt-1 text-gray-500">
Save your config JSON to <a href="https://jsonkeeper.com" target="_blank"
class="text-blue-600 hover:underline">jsonkeeper.com</a> and use the URL
</div>
</div>
</div>
</details>
</div>
</div>
</div>
</div>
<!-- Footer -->
<div class="bg-white border-t border-gray-300 px-4 py-3 flex justify-end gap-2">
<button id="cancel-btn" class="px-4 py-2 border border-gray-300 rounded hover:bg-gray-100">
Cancel
</button>
<button id="add-to-map-btn" class="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700" disabled>
Add Map Layer
</button>
</div>
</div>
<script type="module">
import { MapCreator } from './js/map-creator.js';
const creator = new MapCreator();
creator.init();
// Easter egg: Convert 'google' keyword to Google Maps tiles
const urlInput = document.getElementById('url-input');
urlInput.addEventListener('input', function (e) {
const value = this.value.trim().toLowerCase();
if (value === 'google') {
this.value = 'http://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={z}';
this.dispatchEvent(new Event('change'));
}
});
// Show georeferencing notice for image files
const fileInput = document.getElementById('file-input');
const georefNotice = document.getElementById('georef-notice');
fileInput.addEventListener('change', function (e) {
if (this.files.length > 0) {
const fileName = this.files[0].name.toLowerCase();
const imageExtensions = ['.tif', '.tiff', '.png', '.jpg', '.jpeg'];
const isImageFile = imageExtensions.some(ext => fileName.endsWith(ext));
if (isImageFile) {
georefNotice.classList.remove('hidden');
} else {
georefNotice.classList.add('hidden');
}
} else {
georefNotice.classList.add('hidden');
}
});
</script>
</body>
</html>