diff --git a/frontend/package-lock.json b/frontend/package-lock.json index cf1dd68..db31f6d 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -19,6 +19,7 @@ "lucide-vue-next": "^0.462.0", "maplibre-gl": "^4.7.1", "pinia": "^2.2.8", + "pmtiles": "^4.0.1", "radix-vue": "^1.9.10", "tailwind-merge": "^2.5.5", "tailwindcss-animate": "^1.0.7", @@ -4284,6 +4285,12 @@ "reusify": "^1.0.4" } }, + "node_modules/fflate": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz", + "integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==", + "license": "MIT" + }, "node_modules/figures": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", @@ -5935,6 +5942,15 @@ "node": ">= 6" } }, + "node_modules/pmtiles": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pmtiles/-/pmtiles-4.0.1.tgz", + "integrity": "sha512-YS4uj/v179kA6tDd2E8d7ikOIEHy8ahtXN+u4joZYGkG2EwTkC2DUwgNmYLipyl60Vzf3FnIccIuDZB6bmdKmg==", + "license": "BSD-3-Clause", + "dependencies": { + "fflate": "^0.8.2" + } + }, "node_modules/postcss": { "version": "8.4.49", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz", diff --git a/frontend/package.json b/frontend/package.json index cd5bdc3..a31f043 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -21,6 +21,7 @@ "lucide-vue-next": "^0.462.0", "maplibre-gl": "^4.7.1", "pinia": "^2.2.8", + "pmtiles": "^4.0.1", "radix-vue": "^1.9.10", "tailwind-merge": "^2.5.5", "tailwindcss-animate": "^1.0.7", diff --git a/frontend/src/assets/json/vector.json b/frontend/src/assets/json/vector.json index ce871fa..3794d3e 100644 --- a/frontend/src/assets/json/vector.json +++ b/frontend/src/assets/json/vector.json @@ -33,7 +33,7 @@ }, "cadastre": { "type": "vector", - "url": "https://openmaptiles.geo.data.gouv.fr/data/cadastre-dvf.json" + "url": "pmtiles://https://files.data.gouv.fr/pmtiles/cadastre-dvf-agri.pmtiles" } }, "sprite": "https://openmaptiles.github.io/osm-bright-gl-style/sprite", @@ -2379,4 +2379,4 @@ ], "id": "bright" } - \ No newline at end of file + diff --git a/frontend/src/components/MapComponent.vue b/frontend/src/components/MapComponent.vue index 2020eb1..addc8a4 100644 --- a/frontend/src/components/MapComponent.vue +++ b/frontend/src/components/MapComponent.vue @@ -25,8 +25,12 @@ import { getColorsForNatureCulture } from "@/types/NatureCulture"; import * as d3 from "d3-scale"; import maplibregl, { type Map as MapLibreMap } from "maplibre-gl"; import type { LngLatLike, StyleSpecification } from "maplibre-gl"; +import { Protocol } from "pmtiles"; import { type Ref, defineComponent, onMounted, ref, watch } from "vue"; +let protocol = new Protocol(); +maplibregl.addProtocol("pmtiles",protocol.tile); + export default defineComponent({ name: "MapComponent", components: { @@ -122,7 +126,7 @@ export default defineComponent({ id: "parcelles_fill", type: "fill", source: "cadastre", - filter: ["has", "dvf"], + filter: ["has", "dvf_agri"], "source-layer": "parcelles", minzoom: 13, maxzoom: 18,