diff --git a/package.json b/package.json index 69d2179..5b8fd99 100644 --- a/package.json +++ b/package.json @@ -234,7 +234,6 @@ "/src/components/MlComponentTemplate/", "/src/components/MlAerialPhotograph/", "/src/components/MapLibreMapDebug/", - "/src/components/MlDemoDashboard/", "/src/components/MlLaufwettbewerbApp/", "/src/components/MlLaermkarte/", "/src/components/MlMobilerImker/", diff --git a/src/applications/MlClientseitigeSuche/lib/SearchContext.tsx b/src/applications/MlClientseitigeSuche/lib/SearchContext.tsx index 55057fa..2bd59fc 100644 --- a/src/applications/MlClientseitigeSuche/lib/SearchContext.tsx +++ b/src/applications/MlClientseitigeSuche/lib/SearchContext.tsx @@ -4,6 +4,7 @@ import index from "./searchIndex.json"; import { SearchContextInterface } from "./searchContext.js"; import * as turf from "@turf/turf"; import { MlGeoJsonLayer, useMap } from "@mapcomponents/react-maplibre"; +import worldBoundaries from "./world-administrative-boundaries-countries.json"; const SearchContext = React.createContext( {} as SearchContextInterface @@ -25,6 +26,10 @@ const SearchContextProvider = ({ children }: { children: React.ReactNode }) => { mapId: undefined, }); + useEffect(() => { + setFeatureCollection(worldBoundaries); + }, []); + const getBoundingBox = (geometry: any): turf.BBox => { if ("coordinates" in geometry && geometry.coordinates.length === 2) { geometry = turf.buffer(geometry, 0.03, { @@ -34,23 +39,6 @@ const SearchContextProvider = ({ children }: { children: React.ReactNode }) => { return turf.bbox(geometry); }; - const loadFeatureCollection = useCallback(() => { - fetch(url + "/assets/world-administrative-boundaries-countries.geojson") - .then((res) => { - if (!res.ok) { - throw new Error(); - } - return res.json(); - }) - .then((data) => { - setFeatureCollection(data); - }); - }, []); - - useEffect(() => { - loadFeatureCollection(); - }, [loadFeatureCollection]); - useEffect(() => { // @ts-ignore const loadedIndex = elasticlunr.Index.load(index); diff --git a/public/assets/world-administrative-boundaries-countries.geojson b/src/applications/MlClientseitigeSuche/lib/world-administrative-boundaries-countries.json similarity index 100% rename from public/assets/world-administrative-boundaries-countries.geojson rename to src/applications/MlClientseitigeSuche/lib/world-administrative-boundaries-countries.json