|
@@ -12,6 +12,10 @@
|
|
import { onDestroy, onMount } from 'svelte';
|
|
import { onDestroy, onMount } from 'svelte';
|
|
import 'leaflet.markercluster';
|
|
import 'leaflet.markercluster';
|
|
import { getMapContext } from './map.svelte';
|
|
import { getMapContext } from './map.svelte';
|
|
|
|
+ import { AssetResponseDto } from '@api';
|
|
|
|
+ import { Marker, Icon } from 'leaflet';
|
|
|
|
+
|
|
|
|
+ export let assets: AssetResponseDto[];
|
|
|
|
|
|
const map = getMapContext();
|
|
const map = getMapContext();
|
|
let cluster: L.MarkerClusterGroup;
|
|
let cluster: L.MarkerClusterGroup;
|
|
@@ -26,6 +30,33 @@
|
|
maxClusterRadius: 30,
|
|
maxClusterRadius: 30,
|
|
spiderLegPolylineOptions: { opacity: 0 }
|
|
spiderLegPolylineOptions: { opacity: 0 }
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ for (let asset of assets) {
|
|
|
|
+ if (asset.exifInfo) {
|
|
|
|
+ const lat = asset.exifInfo.latitude;
|
|
|
|
+ const lon = asset.exifInfo.longitude;
|
|
|
|
+
|
|
|
|
+ if (lat && lon) {
|
|
|
|
+ const icon = new Icon({
|
|
|
|
+ iconUrl: `/api/asset/thumbnail/${asset.id}?format=WEBP`,
|
|
|
|
+ iconRetinaUrl: `/api/asset/thumbnail/${asset.id}?format=WEBP`,
|
|
|
|
+ iconSize: [40, 40],
|
|
|
|
+ iconAnchor: [12, 41],
|
|
|
|
+ popupAnchor: [1, -34],
|
|
|
|
+ tooltipAnchor: [16, -28],
|
|
|
|
+ shadowSize: [41, 41]
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ const marker = new Marker([lat, lon], {
|
|
|
|
+ icon,
|
|
|
|
+ alt: ''
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ cluster.addLayer(marker);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
map.addLayer(cluster);
|
|
map.addLayer(cluster);
|
|
});
|
|
});
|
|
|
|
|