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db1
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Saint Lucia Map with GPS</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB41DRUbKWJHPxaFjMAwdrzWzbVKartNGg&callback=initMap&v=weekly" defer></script>
    <style>
        #map {
            height: 500px;
        }
        .user-location-icon {
            width: 20px;
            height: 20px;
            background-color: #3b82f6;
            border-radius: 50%;
            border: 3px solid white;
            box-shadow: 0 0 10px rgba(0,0,0,0.3);
            animation: pulse 2s infinite;
        }
        @keyframes pulse {
            0% { transform: scale(1); opacity: 1; }
            50% { transform: scale(1.3); opacity: 0.7; }
            100% { transform: scale(1); opacity: 1; }
        }
        .accuracy-circle {
            fill: none;
            stroke: #3b82f6;
            stroke-width: 2;
            stroke-opacity: 0.3;
            fill-opacity: 0.1;
        }
    </style>
</head>
<body class="bg-gray-100">
    <header class="bg-blue-600 text-white shadow-lg">
        <div class="container mx-auto px-4 py-6">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="flex items-center mb-4 md:mb-0">
                    <i class="fas fa-map-marked-alt text-3xl mr-3"></i>
                    <h1 class="text-2xl font-bold">Saint Lucia Map</h1>
                </div>
                <div class="flex items-center space-x-4">
                    <button id="locate-btn" class="bg-blue-700 hover:bg-blue-800 text-white px-4 py-2 rounded-lg flex items-center">
                        <i class="fas fa-location-arrow mr-2"></i> Locate Me
                    </button>
                </div>
            </div>
        </div>
    </header>

    <main class="container mx-auto px-4 py-8">
        <div class="bg-white rounded-xl shadow-lg overflow-hidden mb-6">
            <div id="map"></div>
        </div>
        
        <div class="bg-white rounded-xl shadow-lg p-6">
            <h2 class="text-xl font-bold text-blue-600 mb-4 flex items-center">
                <i class="fas fa-info-circle mr-2"></i> Location Information
            </h2>
            <div id="location-info" class="space-y-4">
                <div class="text-center py-8 text-gray-500">
                    <i class="fas fa-map-marker-alt text-4xl mb-2"></i>
                    <p>Click "Locate Me" to find your position on the map</p>
                </div>
            </div>
        </div>
    </main>

    <footer class="bg-gray-800 text-white py-6">
        <div class="container mx-auto px-4">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <p>&copy; 2023 Saint Lucia Map Service. All rights reserved.</p>
                </div>
                <div class="flex space-x-4">
                    <a href="#" class="hover:text-blue-400"><i class="fab fa-twitter"></i></a>
                    <a href="#" class="hover:text-blue-400"><i class="fab fa-facebook"></i></a>
                    <a href="#" class="hover:text-blue-400"><i class="fab fa-instagram"></i></a>
                </div>
            </div>
        </div>
    </footer>

    <script>
        let map;
        let userMarker;
        let accuracyCircle;
        const saintLuciaCenter = { lat: 13.9094, lng: -60.9789 }; // Center of Saint Lucia

        function initMap() {
            // Initialize the map centered on Saint Lucia
            map = new google.maps.Map(document.getElementById("map"), {
                center: saintLuciaCenter,
                zoom: 11,
                styles: [
                    {
                        featureType: "poi",
                        elementType: "labels",
                        stylers: [{ visibility: "off" }]
                    },
                    {
                        featureType: "transit",
                        elementType: "labels.icon",
                        stylers: [{ visibility: "off" }]
                    }
                ]
            });

            // Add some points of interest in Saint Lucia
            addPointsOfInterest();

            // Event listener for locate button
            document.getElementById('locate-btn').addEventListener('click', locateUser);
        }

        function addPointsOfInterest() {
            // Add markers for important locations in Saint Lucia
            const locations = [
                {
                    position: { lat: 14.0167, lng: -60.9833 },
                    title: "Castries",
                    icon: "https://maps.google.com/mapfiles/ms/icons/red-dot.png"
                },
                {
                    position: { lat: 14.0806, lng: -60.9522 },
                    title: "Gros Islet",
                    icon: "https://maps.google.com/mapfiles/ms/icons/blue-dot.png"
                },
                {
                    position: { lat: 13.8536, lng: -61.0667 },
                    title: "Soufrière",
                    icon: "https://maps.google.com/mapfiles/ms/icons/green-dot.png"
                },
                {
                    position: { lat: 13.7300, lng: -60.9500 },
                    title: "Vieux Fort",
                    icon: "https://maps.google.com/mapfiles/ms/icons/yellow-dot.png"
                },
                {
                    position: { lat: 13.9094, lng: -60.9789 },
                    title: "Pitons",
                    icon: "https://maps.google.com/mapfiles/ms/icons/purple-dot.png"
                }
            ];

            locations.forEach(location => {
                new google.maps.Marker({
                    position: location.position,
                    map: map,
                    title: location.title,
                    icon: {
                        url: location.icon,
                        scaledSize: new google.maps.Size(32, 32)
                    }
                });
            });
        }

        function locateUser() {
            const locationInfo = document.getElementById('location-info');
            
            // Check if geolocation is available
            if (navigator.geolocation) {
                locationInfo.innerHTML = `
                    <div class="flex items-center justify-center py-4">
                        <i class="fas fa-spinner fa-spin text-2xl text-blue-600 mr-3"></i>
                        <span class="font-medium">Locating your position...</span>
                    </div>
                `;
                
                // Request current position
                navigator.geolocation.getCurrentPosition(
                    position => {
                        // Success callback
                        showPosition(position);
                    },
                    error => {
                        // Error callback
                        showError(error);
                    },
                    {
                        enableHighAccuracy: true,
                        timeout: 10000,
                        maximumAge: 0
                    }
                );
            } else {
                // Geolocation not supported
                locationInfo.innerHTML = `
                    <div class="bg-red-100 border-l-4 border-red-500 text-red-700 p-4">
                        <div class="flex items-center">
                            <i class="fas fa-exclamation-circle mr-2"></i>
                            <p>Geolocation is not supported by your browser.</p>
                        </div>
                    </div>
                `;
            }
        }

        function showPosition(position) {
            const locationInfo = document.getElementById('location-info');
            const userLatLng = {
                lat: position.coords.latitude,
                lng: position.coords.longitude
            };
            
            // Calculate distance from Saint Lucia center (for demo purposes)
            const distance = calculateDistance(
                userLatLng.lat, userLatLng.lng,
                saintLuciaCenter.lat, saintLuciaCenter.lng
            );
            
            // Update location info panel
            locationInfo.innerHTML = `
                <div class="grid grid-cols-2 gap-4">
                    <div>
                        <p class="text-gray-600 font-medium">Latitude:</p>
                        <p class="font-mono">${userLatLng.lat.toFixed(6)}</p>
                    </div>
                    <div>
                        <p class="text-gray-600 font-medium">Longitude:</p>
                        <p class="font-mono">${userLatLng.lng.toFixed(6)}</p>
                    </div>
                    <div>
                        <p class="text-gray-600 font-medium">Accuracy:</p>
                        <p class="font-mono">${Math.round(position.coords.accuracy)} meters</p>
                    </div>
                    <div>
                        <p class="text-gray-600 font-medium">Distance from Center:</p>
                        <p class="font-mono">${distance.toFixed(2)} km</p>
                    </div>
                </div>
                <div class="mt-4">
                    <p class="text-sm text-gray-500">
                        <i class="fas fa-info-circle mr-1"></i>
                        Last updated: ${new Date().toLocaleTimeString()}
                    </p>
                </div>
            `;
            
            // Remove previous marker and circle if they exist
            if (userMarker) {
                userMarker.setMap(null);
            }
            if (accuracyCircle) {
                accuracyCircle.setMap(null);
            }
            
            // Add user location marker
            userMarker = new google.maps.Marker({
                position: userLatLng,
                map: map,
                title: "Your Location",
                icon: {
                    path: google.maps.SymbolPath.CIRCLE,
                    fillColor: "#3b82f6",
                    fillOpacity: 1,
                    strokeColor: "white",
                    strokeWeight: 2,
                    scale: 10
                },
                animation: google.maps.Animation.DROP
            });
            
            // Add accuracy circle
            accuracyCircle = new google.maps.Circle({
                center: userLatLng,
                radius: position.coords.accuracy,
                map: map,
                fillColor: "#3b82f6",
                fillOpacity: 0.2,
                strokeColor: "#3b82f6",
                strokeOpacity: 0.5,
                strokeWeight: 1
            });
            
            // Center map on user location
            map.setCenter(userLatLng);
            map.setZoom(15);
            
            // Add info window
            const infoWindow = new google.maps.InfoWindow({
                content: `
                    <div class="font-medium">
                        <i class="fas fa-user-circle text-blue-600 mr-1"></i>
                        Your Location
                    </div>
                    <div class="text-sm mt-1">
                        Accuracy: ${Math.round(position.coords.accuracy)} meters
                    </div>
                `
            });
            
            infoWindow.open(map, userMarker);
            
            // Close info window after 5 seconds
            setTimeout(() => {
                infoWindow.close();
            }, 5000);
        }

        function showError(error) {
            const locationInfo = document.getElementById('location-info');
            let errorMessage;
            
            switch(error.code) {
                case error.PERMISSION_DENIED:
                    errorMessage = "You denied the request for geolocation.";
                    break;
                case error.POSITION_UNAVAILABLE:
                    errorMessage = "Location information is unavailable.";
                    break;
                case error.TIMEOUT:
                    errorMessage = "The request to get your location timed out.";
                    break;
                case error.UNKNOWN_ERROR:
                    errorMessage = "An unknown error occurred.";
                    break;
            }
            
            locationInfo.innerHTML = `
                <div class="bg-red-100 border-l-4 border-red-500 text-red-700 p-4">
                    <div class="flex items-center">
                        <i class="fas fa-exclamation-circle mr-2"></i>
                        <p>${errorMessage}</p>
                    </div>
                    <div class="mt-2 text-sm">
                        <button onclick="locateUser()" class="text-blue-600 hover:text-blue-800 font-medium">
                            <i class="fas fa-redo mr-1"></i> Try Again
                        </button>
                    </div>
                </div>
            `;
        }

        // Helper function to calculate distance between two coordinates in km
        function calculateDistance(lat1, lon1, lat2, lon2) {
            const R = 6371; // Radius of the earth in km
            const dLat = deg2rad(lat2 - lat1);
            const dLon = deg2rad(lon2 - lon1); 
            const a = 
                Math.sin(dLat/2) * Math.sin(dLat/2) +
                Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * 
                Math.sin(dLon/2) * Math.sin(dLon/2); 
            const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 
            return R * c;
        }

        function deg2rad(deg) {
            return deg * (Math.PI/180);
        }
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=toppshutter/the-yard" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>