fix(map): remove coordinate swap, properly format basePath filter with quoting
Revert coordinate transformation (PhotoPrism already returns correct [lng,lat] format). Fix basePath filter query string to properly quote paths with special characters and add wildcard suffix using same quoteIfNeeded logic as filters store. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -590,23 +590,6 @@ export async function listGeo(q = ''): Promise<PpGeoCollection> {
|
|||||||
params: { count: 50000, q: q || undefined }
|
params: { count: 50000, q: q || undefined }
|
||||||
});
|
});
|
||||||
|
|
||||||
// PhotoPrism's geo endpoint returns coordinates as [lat, lng] but GeoJSON
|
|
||||||
// (and MapLibre) expect [lng, lat]. Swap the coordinates in each feature.
|
|
||||||
if (data.features) {
|
|
||||||
for (const feature of data.features) {
|
|
||||||
if (feature.geometry.type === 'Point' && Array.isArray(feature.geometry.coordinates)) {
|
|
||||||
const [lat, lng] = feature.geometry.coordinates;
|
|
||||||
feature.geometry.coordinates = [lng, lat];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Also swap bbox if present: [minLat, minLng, maxLat, maxLng] → [minLng, minLat, maxLng, maxLat]
|
|
||||||
if (data.bbox && data.bbox.length === 4) {
|
|
||||||
const [minLat, minLng, maxLat, maxLng] = data.bbox;
|
|
||||||
data.bbox = [minLng, minLat, maxLng, maxLat];
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,9 +13,17 @@
|
|||||||
import { setAnchor, setFocused, setOrder } from '$lib/stores/selection.svelte';
|
import { setAnchor, setFocused, setOrder } from '$lib/stores/selection.svelte';
|
||||||
import Toolbar from '$lib/components/layout/Toolbar.svelte';
|
import Toolbar from '$lib/components/layout/Toolbar.svelte';
|
||||||
|
|
||||||
|
// Helper to quote if needed (matches filters.svelte.ts logic)
|
||||||
|
function quoteIfNeeded(v: string): string {
|
||||||
|
if (!v) return '';
|
||||||
|
if (/^[A-Za-z0-9_\-./]+$/.test(v)) return v;
|
||||||
|
return `"${v.replace(/"/g, '\\"')}"`;
|
||||||
|
}
|
||||||
|
|
||||||
const geoQuery = createQuery<PpGeoCollection>(() => {
|
const geoQuery = createQuery<PpGeoCollection>(() => {
|
||||||
const bp = userBasePath();
|
const bp = userBasePath();
|
||||||
const q = bp ? `path:${bp}*` : '';
|
// Build path filter: add wildcard first, then quote if needed
|
||||||
|
const q = bp ? `path:${quoteIfNeeded(bp + '*')}` : '';
|
||||||
return {
|
return {
|
||||||
queryKey: ['geo', bp],
|
queryKey: ['geo', bp],
|
||||||
queryFn: () => listGeo(q),
|
queryFn: () => listGeo(q),
|
||||||
|
|||||||
Reference in New Issue
Block a user