From dda765adb21b712055fdce3ba3bf98aa695ad6c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Passaniti?= Date: Fri, 31 Dec 2021 02:24:51 +0100 Subject: [PATCH 01/11] OpenLayers explo + premiers composants --- package-lock.json | 558 +++++++++++++++++++++++++++++ package.json | 1 + src/components/Map.svelte | 42 +++ src/components/MapTileLayer.svelte | 38 ++ src/components/MapView.svelte | 19 + src/components/Spinner.svelte | 131 +++++++ src/config.json | 2 +- src/pages/index.svelte | 2 - src/pages/map.svelte | 166 +++++++++ src/pages/mapcomponents.svelte | 136 +++++++ src/utilities/ods.js | 23 +- 11 files changed, 1113 insertions(+), 5 deletions(-) create mode 100644 src/components/Map.svelte create mode 100644 src/components/MapTileLayer.svelte create mode 100644 src/components/MapView.svelte create mode 100644 src/components/Spinner.svelte create mode 100644 src/pages/map.svelte create mode 100644 src/pages/mapcomponents.svelte diff --git a/package-lock.json b/package-lock.json index 83d8b12..7c820fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "autoprefixer": "^10.2.5", "lodash": "^4.17.21", "npm-run-all": "^4.1.5", + "ol": "^6.10.0", "postcss": "^8.2.8", "postcss-import": "^14.0.0", "sass": "^1.43.3", @@ -122,6 +123,49 @@ "node": ">=4" } }, + "node_modules/@mapbox/jsonlint-lines-primitives": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@mapbox/jsonlint-lines-primitives/-/jsonlint-lines-primitives-2.0.2.tgz", + "integrity": "sha1-zlblOfg1UrWNENZy6k1vya3HsjQ=", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/@mapbox/mapbox-gl-style-spec": { + "version": "13.23.0", + "resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-style-spec/-/mapbox-gl-style-spec-13.23.0.tgz", + "integrity": "sha512-zI26XoK0UjGOvOEUUAoKlmFKHrSD8qIMCaoQBsFxNPzGIluryT32Z1m4aq7NtxEsrfE+qc2mPPXQg+iRllqbqA==", + "dev": true, + "dependencies": { + "@mapbox/jsonlint-lines-primitives": "~2.0.2", + "@mapbox/point-geometry": "^0.1.0", + "@mapbox/unitbezier": "^0.0.0", + "csscolorparser": "~1.0.2", + "json-stringify-pretty-compact": "^2.0.0", + "minimist": "^1.2.5", + "rw": "^1.3.3", + "sort-object": "^0.3.2" + }, + "bin": { + "gl-style-composite": "bin/gl-style-composite", + "gl-style-format": "bin/gl-style-format", + "gl-style-migrate": "bin/gl-style-migrate", + "gl-style-validate": "bin/gl-style-validate" + } + }, + "node_modules/@mapbox/point-geometry": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz", + "integrity": "sha1-ioP5M1x4YO/6Lu7KJUMyqgru2PI=", + "dev": true + }, + "node_modules/@mapbox/unitbezier": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/@mapbox/unitbezier/-/unitbezier-0.0.0.tgz", + "integrity": "sha1-FWUb1VOme4WB+zmIEMmK2Go0Uk4=", + "dev": true + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -169,6 +213,12 @@ "node": ">=10" } }, + "node_modules/@petamoriken/float16": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/@petamoriken/float16/-/float16-3.6.0.tgz", + "integrity": "sha512-FTMbOb9BQcfIBLx7uanCXieFEb9iWJpjLkqV5QhXo/YYArBq/4G73txEoh4Nm9jw6Z2+p55KKx7UKo48QjyG5Q==", + "dev": true + }, "node_modules/@rollup/pluginutils": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-4.1.1.tgz", @@ -770,6 +820,12 @@ "integrity": "sha512-IiJwMC8rdZE0+xiEZHeru6YoONC4rfPMqGm2W85jMIbkFvv5nFTwJVFHam2eFrN6txmoUYFAFXiv8ICVeTO0MA==", "dev": true }, + "node_modules/csscolorparser": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/csscolorparser/-/csscolorparser-1.0.3.tgz", + "integrity": "sha1-s085HupNqPPpgjHizNjfnAQfFxs=", + "dev": true + }, "node_modules/cssesc": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", @@ -1214,6 +1270,25 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, + "node_modules/geotiff": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/geotiff/-/geotiff-1.0.9.tgz", + "integrity": "sha512-PY+q1OP8RtQZkx1630pVfC3hEkxFnGW9LwIF/glSzcalyShkrH+W8uM/M4RVY12j4QkDQvRXVKOpU65hq6t0iQ==", + "dev": true, + "dependencies": { + "@petamoriken/float16": "^3.4.7", + "lerc": "^3.0.0", + "lru-cache": "^6.0.0", + "pako": "^2.0.4", + "parse-headers": "^2.0.2", + "threads": "^1.7.0", + "xml-utils": "^1.0.2" + }, + "engines": { + "browsers": "defaults", + "node": ">=10.19" + } + }, "node_modules/get-intrinsic": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", @@ -1407,6 +1482,26 @@ "node": ">=0.10.0" } }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/immutability-helper": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/immutability-helper/-/immutability-helper-3.1.1.tgz", @@ -1648,6 +1743,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-observable": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-observable/-/is-observable-2.1.0.tgz", + "integrity": "sha512-DailKdLb0WU+xX8K5w7VsJhapwHLZ9jjmazqCJq4X12CTgqq73TKnbRcnSLuXYPOoLQgV5IrD7ePiX/h1vnkBw==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-potential-custom-element-name": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", @@ -1770,6 +1877,12 @@ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true }, + "node_modules/json-stringify-pretty-compact": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/json-stringify-pretty-compact/-/json-stringify-pretty-compact-2.0.0.tgz", + "integrity": "sha512-WRitRfs6BGq4q8gTgOy4ek7iPFXjbra0H3PmDLKm2xnZ+Gh1HUhiKGgCZkSPNULlP7mvfu6FV/mOLhCarspADQ==", + "dev": true + }, "node_modules/jsonfile": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", @@ -1791,6 +1904,12 @@ "node": ">=6" } }, + "node_modules/lerc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lerc/-/lerc-3.0.0.tgz", + "integrity": "sha512-Rm4J/WaHhRa93nCN2mwWDZFoRVF18G1f47C+kvQWyHGEZxFpTUi73p7lMVSAndyxGt6lJ2/CFbOcf9ra5p8aww==", + "dev": true + }, "node_modules/levn": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", @@ -1929,6 +2048,18 @@ "node": ">=4" } }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/magic-string": { "version": "0.25.7", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", @@ -1938,6 +2069,12 @@ "sourcemap-codec": "^1.4.4" } }, + "node_modules/mapbox-to-css-font": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/mapbox-to-css-font/-/mapbox-to-css-font-2.4.0.tgz", + "integrity": "sha512-v674D0WtpxCXlA6E+sBlG1QJWdUkz/s9qAD91bJSXBGuBL5lL4tJXpoJEftecphCh2SVQCjWMS2vhylc3AIQTg==", + "dev": true + }, "node_modules/memorystream": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", @@ -2256,6 +2393,39 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/observable-fns": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/observable-fns/-/observable-fns-0.6.1.tgz", + "integrity": "sha512-9gRK4+sRWzeN6AOewNBTLXir7Zl/i3GB6Yl26gK4flxz8BXVpD3kt8amREmWNb0mxYOGDotvE5a4N+PtGGKdkg==", + "dev": true + }, + "node_modules/ol": { + "version": "6.10.0", + "resolved": "https://registry.npmjs.org/ol/-/ol-6.10.0.tgz", + "integrity": "sha512-XBU0IzeCU50MUOmCoBH5ThimGUt6oiNf8LL3iRVeLckpg7Q/0i4jernuJTpg8OLVzcgxG+ex/0iXf9mgHSzM6Q==", + "dev": true, + "dependencies": { + "geotiff": "^1.0.8", + "ol-mapbox-style": "^6.7.0", + "pbf": "3.2.1", + "rbush": "^3.0.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/openlayers" + } + }, + "node_modules/ol-mapbox-style": { + "version": "6.8.1", + "resolved": "https://registry.npmjs.org/ol-mapbox-style/-/ol-mapbox-style-6.8.1.tgz", + "integrity": "sha512-HD3FNFzFiBptEwiLIVna7H/WSpv/cN99xMmIErcvqv/r4XLwWS/8VKti8w6moVPV28Fg2QmitXvaG3okedMU7w==", + "dev": true, + "dependencies": { + "@mapbox/mapbox-gl-style-spec": "^13.20.1", + "mapbox-to-css-font": "^2.4.0", + "webfont-matcher": "^1.1.0" + } + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -2282,6 +2452,12 @@ "node": ">= 0.8.0" } }, + "node_modules/pako": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pako/-/pako-2.0.4.tgz", + "integrity": "sha512-v8tweI900AUkZN6heMU/4Uy4cXRc2AYNRggVmTR+dEncawDJgCdLMximOVA2p4qO57WMynangsfGRb5WD6L1Bg==", + "dev": true + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -2294,6 +2470,12 @@ "node": ">=6" } }, + "node_modules/parse-headers": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.4.tgz", + "integrity": "sha512-psZ9iZoCNFLrgRjZ1d8mn0h9WRqJwFxM9q3x7iUjN/YT2OksthDJ5TiPCu2F38kS4zutqfW+YdVVkBZZx3/1aw==", + "dev": true + }, "node_modules/parse-json": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", @@ -2358,6 +2540,19 @@ "node": ">=4" } }, + "node_modules/pbf": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/pbf/-/pbf-3.2.1.tgz", + "integrity": "sha512-ClrV7pNOn7rtmoQVF4TS1vyU0WhYRnP92fzbfF75jAIwpnzdJXf8iTd4CMEqO4yUenH6NDqLiwjqlh6QgZzgLQ==", + "dev": true, + "dependencies": { + "ieee754": "^1.1.12", + "resolve-protobuf-schema": "^2.1.0" + }, + "bin": { + "pbf": "bin/pbf" + } + }, "node_modules/picomatch": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", @@ -2525,6 +2720,12 @@ "node": ">= 0.8" } }, + "node_modules/protocol-buffers-schema": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz", + "integrity": "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw==", + "dev": true + }, "node_modules/psl": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", @@ -2596,6 +2797,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/quickselect": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-2.0.0.tgz", + "integrity": "sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw==", + "dev": true + }, + "node_modules/rbush": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/rbush/-/rbush-3.0.1.tgz", + "integrity": "sha512-XRaVO0YecOpEuIvbhbpTrZgoiI6xBlz6hnlr6EHhd+0x9ase6EmeN+hdwwUaJvLcsFFQ8iWVF1GAK1yB0BWi0w==", + "dev": true, + "dependencies": { + "quickselect": "^2.0.0" + } + }, "node_modules/read-cache": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", @@ -2675,6 +2891,15 @@ "node": ">=4" } }, + "node_modules/resolve-protobuf-schema": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/resolve-protobuf-schema/-/resolve-protobuf-schema-2.1.0.tgz", + "integrity": "sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==", + "dev": true, + "dependencies": { + "protocol-buffers-schema": "^3.3.1" + } + }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -2765,6 +2990,12 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/rw": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz", + "integrity": "sha1-P4Yt+pGrdmsUiF700BEkv9oHT7Q=", + "dev": true + }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -2863,6 +3094,37 @@ "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==", "dev": true }, + "node_modules/sort-asc": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/sort-asc/-/sort-asc-0.1.0.tgz", + "integrity": "sha1-q3md9h/HPqCVbHnEtTHtHp53J+k=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sort-desc": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/sort-desc/-/sort-desc-0.1.1.tgz", + "integrity": "sha1-GYuMDN6wlcRjNBhh45JdTuNZqe4=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sort-object": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/sort-object/-/sort-object-0.3.2.tgz", + "integrity": "sha1-mODRme3kDgfGGoRAPGHWw7KQ+eI=", + "dev": true, + "dependencies": { + "sort-asc": "^0.1.0", + "sort-desc": "^0.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -3166,6 +3428,34 @@ "node": ">=10.13.0" } }, + "node_modules/threads": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/threads/-/threads-1.7.0.tgz", + "integrity": "sha512-Mx5NBSHX3sQYR6iI9VYbgHKBLisyB+xROCBGjjWm1O9wb9vfLxdaGtmT/KCjUqMsSNW6nERzCW3T6H43LqjDZQ==", + "dev": true, + "dependencies": { + "callsites": "^3.1.0", + "debug": "^4.2.0", + "is-observable": "^2.1.0", + "observable-fns": "^0.6.1" + }, + "funding": { + "url": "https://github.com/andywer/threads.js?sponsor=1" + }, + "optionalDependencies": { + "tiny-worker": ">= 2" + } + }, + "node_modules/tiny-worker": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/tiny-worker/-/tiny-worker-2.3.0.tgz", + "integrity": "sha512-pJ70wq5EAqTAEl9IkGzA+fN0836rycEuz2Cn6yeZ6FRzlVS5IDOkFHpIoEsksPRQV34GDqXm65+OlnZqUSyK2g==", + "dev": true, + "optional": true, + "dependencies": { + "esm": "^3.2.25" + } + }, "node_modules/tmp": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", @@ -3329,6 +3619,12 @@ "node": ">=10" } }, + "node_modules/webfont-matcher": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/webfont-matcher/-/webfont-matcher-1.1.0.tgz", + "integrity": "sha1-mM6VCXsp4x++czBT4Q5XFkLRxsc=", + "dev": true + }, "node_modules/webidl-conversions": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", @@ -3437,6 +3733,12 @@ "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", "dev": true }, + "node_modules/xml-utils": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/xml-utils/-/xml-utils-1.0.2.tgz", + "integrity": "sha512-rEn0FvKi+YGjv9omf22oAf+0d6Ly/sgJ/CUufU/nOzS7SRLmgwSujrewc03KojXxt+aPaTRpm593TgehtUBMSQ==", + "dev": true + }, "node_modules/xmlchars": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", @@ -3452,6 +3754,12 @@ "node": ">=0.4" } }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "node_modules/yaml": { "version": "1.10.2", "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", @@ -3541,6 +3849,40 @@ } } }, + "@mapbox/jsonlint-lines-primitives": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@mapbox/jsonlint-lines-primitives/-/jsonlint-lines-primitives-2.0.2.tgz", + "integrity": "sha1-zlblOfg1UrWNENZy6k1vya3HsjQ=", + "dev": true + }, + "@mapbox/mapbox-gl-style-spec": { + "version": "13.23.0", + "resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-style-spec/-/mapbox-gl-style-spec-13.23.0.tgz", + "integrity": "sha512-zI26XoK0UjGOvOEUUAoKlmFKHrSD8qIMCaoQBsFxNPzGIluryT32Z1m4aq7NtxEsrfE+qc2mPPXQg+iRllqbqA==", + "dev": true, + "requires": { + "@mapbox/jsonlint-lines-primitives": "~2.0.2", + "@mapbox/point-geometry": "^0.1.0", + "@mapbox/unitbezier": "^0.0.0", + "csscolorparser": "~1.0.2", + "json-stringify-pretty-compact": "^2.0.0", + "minimist": "^1.2.5", + "rw": "^1.3.3", + "sort-object": "^0.3.2" + } + }, + "@mapbox/point-geometry": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz", + "integrity": "sha1-ioP5M1x4YO/6Lu7KJUMyqgru2PI=", + "dev": true + }, + "@mapbox/unitbezier": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/@mapbox/unitbezier/-/unitbezier-0.0.0.tgz", + "integrity": "sha1-FWUb1VOme4WB+zmIEMmK2Go0Uk4=", + "dev": true + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -3576,6 +3918,12 @@ "immutability-helper": "^3.1.1" } }, + "@petamoriken/float16": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/@petamoriken/float16/-/float16-3.6.0.tgz", + "integrity": "sha512-FTMbOb9BQcfIBLx7uanCXieFEb9iWJpjLkqV5QhXo/YYArBq/4G73txEoh4Nm9jw6Z2+p55KKx7UKo48QjyG5Q==", + "dev": true + }, "@rollup/pluginutils": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-4.1.1.tgz", @@ -4038,6 +4386,12 @@ "integrity": "sha512-IiJwMC8rdZE0+xiEZHeru6YoONC4rfPMqGm2W85jMIbkFvv5nFTwJVFHam2eFrN6txmoUYFAFXiv8ICVeTO0MA==", "dev": true }, + "csscolorparser": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/csscolorparser/-/csscolorparser-1.0.3.tgz", + "integrity": "sha1-s085HupNqPPpgjHizNjfnAQfFxs=", + "dev": true + }, "cssesc": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", @@ -4369,6 +4723,21 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, + "geotiff": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/geotiff/-/geotiff-1.0.9.tgz", + "integrity": "sha512-PY+q1OP8RtQZkx1630pVfC3hEkxFnGW9LwIF/glSzcalyShkrH+W8uM/M4RVY12j4QkDQvRXVKOpU65hq6t0iQ==", + "dev": true, + "requires": { + "@petamoriken/float16": "^3.4.7", + "lerc": "^3.0.0", + "lru-cache": "^6.0.0", + "pako": "^2.0.4", + "parse-headers": "^2.0.2", + "threads": "^1.7.0", + "xml-utils": "^1.0.2" + } + }, "get-intrinsic": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", @@ -4514,6 +4883,12 @@ "safer-buffer": ">= 2.1.2 < 3" } }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true + }, "immutability-helper": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/immutability-helper/-/immutability-helper-3.1.1.tgz", @@ -4691,6 +5066,12 @@ "has-tostringtag": "^1.0.0" } }, + "is-observable": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-observable/-/is-observable-2.1.0.tgz", + "integrity": "sha512-DailKdLb0WU+xX8K5w7VsJhapwHLZ9jjmazqCJq4X12CTgqq73TKnbRcnSLuXYPOoLQgV5IrD7ePiX/h1vnkBw==", + "dev": true + }, "is-potential-custom-element-name": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", @@ -4784,6 +5165,12 @@ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true }, + "json-stringify-pretty-compact": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/json-stringify-pretty-compact/-/json-stringify-pretty-compact-2.0.0.tgz", + "integrity": "sha512-WRitRfs6BGq4q8gTgOy4ek7iPFXjbra0H3PmDLKm2xnZ+Gh1HUhiKGgCZkSPNULlP7mvfu6FV/mOLhCarspADQ==", + "dev": true + }, "jsonfile": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", @@ -4800,6 +5187,12 @@ "integrity": "sha512-8QADVssbrFjivHWQU7KkMgptGTl6WAcSdlbBPY4uNF+mWr6DGcKrvY2w4FQJoXch7+fKMjj0dRrL75vk3k23OA==", "dev": true }, + "lerc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lerc/-/lerc-3.0.0.tgz", + "integrity": "sha512-Rm4J/WaHhRa93nCN2mwWDZFoRVF18G1f47C+kvQWyHGEZxFpTUi73p7lMVSAndyxGt6lJ2/CFbOcf9ra5p8aww==", + "dev": true + }, "levn": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", @@ -4915,6 +5308,15 @@ } } }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, "magic-string": { "version": "0.25.7", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", @@ -4924,6 +5326,12 @@ "sourcemap-codec": "^1.4.4" } }, + "mapbox-to-css-font": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/mapbox-to-css-font/-/mapbox-to-css-font-2.4.0.tgz", + "integrity": "sha512-v674D0WtpxCXlA6E+sBlG1QJWdUkz/s9qAD91bJSXBGuBL5lL4tJXpoJEftecphCh2SVQCjWMS2vhylc3AIQTg==", + "dev": true + }, "memorystream": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", @@ -5162,6 +5570,35 @@ "object-keys": "^1.1.1" } }, + "observable-fns": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/observable-fns/-/observable-fns-0.6.1.tgz", + "integrity": "sha512-9gRK4+sRWzeN6AOewNBTLXir7Zl/i3GB6Yl26gK4flxz8BXVpD3kt8amREmWNb0mxYOGDotvE5a4N+PtGGKdkg==", + "dev": true + }, + "ol": { + "version": "6.10.0", + "resolved": "https://registry.npmjs.org/ol/-/ol-6.10.0.tgz", + "integrity": "sha512-XBU0IzeCU50MUOmCoBH5ThimGUt6oiNf8LL3iRVeLckpg7Q/0i4jernuJTpg8OLVzcgxG+ex/0iXf9mgHSzM6Q==", + "dev": true, + "requires": { + "geotiff": "^1.0.8", + "ol-mapbox-style": "^6.7.0", + "pbf": "3.2.1", + "rbush": "^3.0.1" + } + }, + "ol-mapbox-style": { + "version": "6.8.1", + "resolved": "https://registry.npmjs.org/ol-mapbox-style/-/ol-mapbox-style-6.8.1.tgz", + "integrity": "sha512-HD3FNFzFiBptEwiLIVna7H/WSpv/cN99xMmIErcvqv/r4XLwWS/8VKti8w6moVPV28Fg2QmitXvaG3okedMU7w==", + "dev": true, + "requires": { + "@mapbox/mapbox-gl-style-spec": "^13.20.1", + "mapbox-to-css-font": "^2.4.0", + "webfont-matcher": "^1.1.0" + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -5185,6 +5622,12 @@ "word-wrap": "~1.2.3" } }, + "pako": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pako/-/pako-2.0.4.tgz", + "integrity": "sha512-v8tweI900AUkZN6heMU/4Uy4cXRc2AYNRggVmTR+dEncawDJgCdLMximOVA2p4qO57WMynangsfGRb5WD6L1Bg==", + "dev": true + }, "parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -5194,6 +5637,12 @@ "callsites": "^3.0.0" } }, + "parse-headers": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.4.tgz", + "integrity": "sha512-psZ9iZoCNFLrgRjZ1d8mn0h9WRqJwFxM9q3x7iUjN/YT2OksthDJ5TiPCu2F38kS4zutqfW+YdVVkBZZx3/1aw==", + "dev": true + }, "parse-json": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", @@ -5245,6 +5694,16 @@ } } }, + "pbf": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/pbf/-/pbf-3.2.1.tgz", + "integrity": "sha512-ClrV7pNOn7rtmoQVF4TS1vyU0WhYRnP92fzbfF75jAIwpnzdJXf8iTd4CMEqO4yUenH6NDqLiwjqlh6QgZzgLQ==", + "dev": true, + "requires": { + "ieee754": "^1.1.12", + "resolve-protobuf-schema": "^2.1.0" + } + }, "picomatch": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", @@ -5343,6 +5802,12 @@ "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=", "dev": true }, + "protocol-buffers-schema": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz", + "integrity": "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw==", + "dev": true + }, "psl": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", @@ -5387,6 +5852,21 @@ "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", "dev": true }, + "quickselect": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-2.0.0.tgz", + "integrity": "sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw==", + "dev": true + }, + "rbush": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/rbush/-/rbush-3.0.1.tgz", + "integrity": "sha512-XRaVO0YecOpEuIvbhbpTrZgoiI6xBlz6hnlr6EHhd+0x9ase6EmeN+hdwwUaJvLcsFFQ8iWVF1GAK1yB0BWi0w==", + "dev": true, + "requires": { + "quickselect": "^2.0.0" + } + }, "read-cache": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", @@ -5456,6 +5936,15 @@ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true }, + "resolve-protobuf-schema": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/resolve-protobuf-schema/-/resolve-protobuf-schema-2.1.0.tgz", + "integrity": "sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==", + "dev": true, + "requires": { + "protocol-buffers-schema": "^3.3.1" + } + }, "reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -5518,6 +6007,12 @@ "queue-microtask": "^1.2.2" } }, + "rw": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz", + "integrity": "sha1-P4Yt+pGrdmsUiF700BEkv9oHT7Q=", + "dev": true + }, "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -5597,6 +6092,28 @@ } } }, + "sort-asc": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/sort-asc/-/sort-asc-0.1.0.tgz", + "integrity": "sha1-q3md9h/HPqCVbHnEtTHtHp53J+k=", + "dev": true + }, + "sort-desc": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/sort-desc/-/sort-desc-0.1.1.tgz", + "integrity": "sha1-GYuMDN6wlcRjNBhh45JdTuNZqe4=", + "dev": true + }, + "sort-object": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/sort-object/-/sort-object-0.3.2.tgz", + "integrity": "sha1-mODRme3kDgfGGoRAPGHWw7KQ+eI=", + "dev": true, + "requires": { + "sort-asc": "^0.1.0", + "sort-desc": "^0.1.1" + } + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -5801,6 +6318,29 @@ } } }, + "threads": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/threads/-/threads-1.7.0.tgz", + "integrity": "sha512-Mx5NBSHX3sQYR6iI9VYbgHKBLisyB+xROCBGjjWm1O9wb9vfLxdaGtmT/KCjUqMsSNW6nERzCW3T6H43LqjDZQ==", + "dev": true, + "requires": { + "callsites": "^3.1.0", + "debug": "^4.2.0", + "is-observable": "^2.1.0", + "observable-fns": "^0.6.1", + "tiny-worker": ">= 2" + } + }, + "tiny-worker": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/tiny-worker/-/tiny-worker-2.3.0.tgz", + "integrity": "sha512-pJ70wq5EAqTAEl9IkGzA+fN0836rycEuz2Cn6yeZ6FRzlVS5IDOkFHpIoEsksPRQV34GDqXm65+OlnZqUSyK2g==", + "dev": true, + "optional": true, + "requires": { + "esm": "^3.2.25" + } + }, "tmp": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", @@ -5930,6 +6470,12 @@ "xml-name-validator": "^3.0.0" } }, + "webfont-matcher": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/webfont-matcher/-/webfont-matcher-1.1.0.tgz", + "integrity": "sha1-mM6VCXsp4x++czBT4Q5XFkLRxsc=", + "dev": true + }, "webidl-conversions": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", @@ -6009,6 +6555,12 @@ "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", "dev": true }, + "xml-utils": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/xml-utils/-/xml-utils-1.0.2.tgz", + "integrity": "sha512-rEn0FvKi+YGjv9omf22oAf+0d6Ly/sgJ/CUufU/nOzS7SRLmgwSujrewc03KojXxt+aPaTRpm593TgehtUBMSQ==", + "dev": true + }, "xmlchars": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", @@ -6021,6 +6573,12 @@ "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", "dev": true }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "yaml": { "version": "1.10.2", "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", diff --git a/package.json b/package.json index 52a4ab8..333c8c1 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "autoprefixer": "^10.2.5", "lodash": "^4.17.21", "npm-run-all": "^4.1.5", + "ol": "^6.10.0", "postcss": "^8.2.8", "postcss-import": "^14.0.0", "sass": "^1.43.3", diff --git a/src/components/Map.svelte b/src/components/Map.svelte new file mode 100644 index 0000000..c15cafc --- /dev/null +++ b/src/components/Map.svelte @@ -0,0 +1,42 @@ + + +
+ {#if htmlElement} + + {/if} +
+ + \ No newline at end of file diff --git a/src/components/MapTileLayer.svelte b/src/components/MapTileLayer.svelte new file mode 100644 index 0000000..132aef4 --- /dev/null +++ b/src/components/MapTileLayer.svelte @@ -0,0 +1,38 @@ + \ No newline at end of file diff --git a/src/components/MapView.svelte b/src/components/MapView.svelte new file mode 100644 index 0000000..d7aa00f --- /dev/null +++ b/src/components/MapView.svelte @@ -0,0 +1,19 @@ + \ No newline at end of file diff --git a/src/components/Spinner.svelte b/src/components/Spinner.svelte new file mode 100644 index 0000000..4a8d6e0 --- /dev/null +++ b/src/components/Spinner.svelte @@ -0,0 +1,131 @@ + + +
+ + \ No newline at end of file diff --git a/src/config.json b/src/config.json index d612bfb..061edc8 100644 --- a/src/config.json +++ b/src/config.json @@ -1,7 +1,7 @@ { "domainid": "public", "datasetid": "res_equipements_2017", - "filters": ["gestiontypeproprietaireprinclib", "equipementtypelib"], + "filters": ["deplib", "gestiontypeproprietaireprinclib", "equipementtypelib"], "fieldTitle": "insnom", "fieldCoordinates": "coordonnees", "fieldList": [{ diff --git a/src/pages/index.svelte b/src/pages/index.svelte index 62e47c6..eb3702b 100644 --- a/src/pages/index.svelte +++ b/src/pages/index.svelte @@ -1,12 +1,10 @@ + +
+
+ + +
+ {#each config.filters as filter} + option[filter]} + getSelectionLabel={(option) => option[filter]} + on:select={function moncallbackrefine(event) { + if (event.detail) { + let id = Object.keys(event.detail)[0]; + activeFilter[id] = event.detail[id]; + } + debouncedRefresh(); + }} + on:clear={function moncallbackdevenement(event) { + delete activeFilter[filter]; + debouncedRefresh(); + }}/> + {/each} +
+
+ +
+ + + + + +
+
+ + diff --git a/src/utilities/ods.js b/src/utilities/ods.js index 40e31ef..0ac6ad4 100644 --- a/src/utilities/ods.js +++ b/src/utilities/ods.js @@ -1,4 +1,5 @@ -import { ApiClient, fromCatalog } from '@opendatasoft/api-client'; +import { ApiClient } from '../../../ods-dataviz-sdk/packages/api-client/src/client'; +import { fromCatalog } from '../../../ods-dataviz-sdk/packages/api-client/src/odsql'; const getDatasets = async(domainid) => { if (!domainid) return { datasets: [] }; @@ -32,6 +33,24 @@ const getRecords = async(domainid, datasetid, search = "", refine = {}) => { }); }; +const getGeojson = async(domainid, datasetid, search = "", refine = {}, limit = 100) => { + // refine : { 'fieldid' : 'valeur du refine' } + const client = new ApiClient({ domain: domainid }); + let query = fromCatalog().dataset(datasetid).exports('geojson').limit(limit); + let keys = Object.keys(refine); + for (let i = 0; i < keys.length; i += 1) { + query = query.refine(`${keys[i]}:"${refine[keys[i]]}"`); + } + if (search) { + query = query.where(`"${search}"`) + } + return client.get(query) + .then(res => res) + .catch(err => { + throw err; + }); +}; + const getFilterCategories = async(domainid, datasetid, search = "", field, refine = {}) => { const client = new ApiClient({ domain: domainid }); let query = fromCatalog() @@ -116,4 +135,4 @@ const getNext = async(links) => { }); } -export default { getRecords, getDatasets, getNext, getFilterCategories, getAggregates, getKpis } \ No newline at end of file +export default { getRecords, getDatasets, getGeojson, getNext, getFilterCategories, getAggregates, getKpis } \ No newline at end of file From 6f669d810a622d0716825f2f29716b566957cdf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Passaniti?= Date: Fri, 31 Dec 2021 02:41:12 +0100 Subject: [PATCH 02/11] it works ! --- src/components/DataLayer.svelte | 35 +++++++++++++++++++++++++++++++++ src/pages/mapcomponents.svelte | 11 ++++------- 2 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 src/components/DataLayer.svelte diff --git a/src/components/DataLayer.svelte b/src/components/DataLayer.svelte new file mode 100644 index 0000000..6af2b90 --- /dev/null +++ b/src/components/DataLayer.svelte @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/src/pages/mapcomponents.svelte b/src/pages/mapcomponents.svelte index ffeb8b0..2ab3fd0 100644 --- a/src/pages/mapcomponents.svelte +++ b/src/pages/mapcomponents.svelte @@ -17,6 +17,7 @@ import Map from "../components/Map.svelte"; import MapView from "../components/MapView.svelte"; import MapTileLayer from "../components/MapTileLayer.svelte"; + import DataLayer from "../components/DataLayer.svelte"; let loading = false; let errorMsg; @@ -26,23 +27,18 @@ let activeFilter = {}; let category = []; - let geojsonFeatures = []; + let geojson; const debouncedRefresh = debounce(async () => { - geojsonFeatures = []; loading = true; ods.getGeojson(config.domainid, config.datasetid, search, activeFilter, 500) .then((res) => { - geojsonFeatures = new GeoJSON().readFeatures(res, { - dataProjection: "EPSG:4326", - featureProjection: "EPSG:3857" - }); + geojson = res; errorMsg = undefined; }) .catch((err) => { errorMsg = `Pas d'enregistrement (${err.message})`; console.error(err); - geojsonFeatures = []; }) .finally(() => { loading = false; @@ -105,6 +101,7 @@ +
From 4cc05baa3adf05eb90390db2295f6cb231855b06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Passaniti?= Date: Fri, 31 Dec 2021 18:23:09 +0100 Subject: [PATCH 03/11] map avec clustering, marker cluster, zoom au click, patatoid au hover --- package-lock.json | 11 ++ package.json | 1 + src/pages/map.svelte | 286 ++++++++++++++++++++++++++-- src/pages/map_cluster_simple.svelte | 249 ++++++++++++++++++++++++ 4 files changed, 531 insertions(+), 16 deletions(-) create mode 100644 src/pages/map_cluster_simple.svelte diff --git a/package-lock.json b/package-lock.json index 7c820fe..6da4e6d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "name": "vite-svelte-routify-starter", "dependencies": { "chart.js": "^3.6.1", + "monotone-chain-convex-hull": "^1.0.0", "svelte-select": "^4.4.6" }, "devDependencies": { @@ -2166,6 +2167,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/monotone-chain-convex-hull": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/monotone-chain-convex-hull/-/monotone-chain-convex-hull-1.0.0.tgz", + "integrity": "sha1-5eOjnzBda8b+cQYvxwcrxWw6VeA=" + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -5396,6 +5402,11 @@ "integrity": "sha512-2lMlY1Yc1+CUy0gw4H95uNN7vjbpoED7NNRSBHE25nWfLBdmMzFCsPshlzbxHz+gYMcBEUN8V4pU16prcdPSgA==", "dev": true }, + "monotone-chain-convex-hull": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/monotone-chain-convex-hull/-/monotone-chain-convex-hull-1.0.0.tgz", + "integrity": "sha1-5eOjnzBda8b+cQYvxwcrxWw6VeA=" + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", diff --git a/package.json b/package.json index 333c8c1..00f24d8 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ }, "dependencies": { "chart.js": "^3.6.1", + "monotone-chain-convex-hull": "^1.0.0", "svelte-select": "^4.4.6" } } diff --git a/src/pages/map.svelte b/src/pages/map.svelte index 1e8558d..cf5f224 100644 --- a/src/pages/map.svelte +++ b/src/pages/map.svelte @@ -1,7 +1,9 @@ diff --git a/src/pages/map_cluster_simple.svelte b/src/pages/map_cluster_simple.svelte new file mode 100644 index 0000000..78a2c44 --- /dev/null +++ b/src/pages/map_cluster_simple.svelte @@ -0,0 +1,249 @@ + + +
+
+ + +
+ {#each config.filters as filter} + { + if (event.detail) { + let id = Object.keys(event.detail)[0]; + refines[field] = event.detail[id]; + refines = refines; + } + }} + on:clear={(event) => { + console.log("delete : " + refines[field]) + delete refines[field]; + refines = refines; // trigger reactivity, not detected by delete operator + }}/> \ No newline at end of file diff --git a/src/components/OdsFacetResults.svelte b/src/components/OdsFacetResults.svelte new file mode 100644 index 0000000..0a7186f --- /dev/null +++ b/src/components/OdsFacetResults.svelte @@ -0,0 +1,21 @@ + \ No newline at end of file diff --git a/src/components/OdsRecords.svelte b/src/components/OdsRecords.svelte new file mode 100644 index 0000000..b549496 --- /dev/null +++ b/src/components/OdsRecords.svelte @@ -0,0 +1,19 @@ + \ No newline at end of file diff --git a/src/components/OdsSearchbar.svelte b/src/components/OdsSearchbar.svelte new file mode 100644 index 0000000..3f81ace --- /dev/null +++ b/src/components/OdsSearchbar.svelte @@ -0,0 +1,30 @@ + + + + + diff --git a/src/components/Table.svelte b/src/components/Table.svelte index 21db8ce..6d227bc 100644 --- a/src/components/Table.svelte +++ b/src/components/Table.svelte @@ -65,63 +65,4 @@ .table-basic tr td { padding: 13px 6px; } - /* Dropdown */ - .table-dropdown-container { - position: relative; - margin-right: 4px;; - } - .table-dropdown-button { - width: 28px; - height: 28px; - padding: 0; - line-height: 1; - display: flex; - align-items: center; - justify-content: center; - background: white; - border: 1px solid transparent; - border-radius: 4px; - margin-left: auto; - } - .table-basic tr:hover .table-dropdown-button { - border-color: var(--highlight); - } - .table-dropdown-button-active { - box-shadow: 0 0 0 3px rgba(20, 46, 123, 0.3); - border-color: var(--highlight); - } - .table-dropdown { - visibility: hidden; - opacity: 0; - position: absolute; - z-index: 3; - top: 0; - right: 0; - border: 1px solid #FFFFFF; - border-radius: 4px; - border-color: rgba(222, 229, 239, 1); - padding: 13px; - white-space: nowrap; - background: white; - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15); - transition: visibility 0s, opacity 0.1s ease, top 0.1s ease; - } - .table-dropdown-visible { - visibility: visible; - opacity: 1; - top: 38px; - } - .table-dropdown-item { - padding: 2px 6px 2px 0; - display: block; - } - .table-dropdown-backdrop { - position: fixed; - top: 0; - bottom: 0; - left: 0; - right: 0; - cursor: auto; - } - diff --git a/src/pages/querycomponents.svelte b/src/pages/querycomponents.svelte new file mode 100644 index 0000000..9af7cce --- /dev/null +++ b/src/pages/querycomponents.svelte @@ -0,0 +1,61 @@ + + +
+
+ +
+ {#each config.filters as filter} + + {/each} +
+
+ + + + + diff --git a/src/utilities/ods.js b/src/utilities/ods.js index bd9d41f..3920baa 100644 --- a/src/utilities/ods.js +++ b/src/utilities/ods.js @@ -1,9 +1,9 @@ -import { ApiClient } from '../../../ods-dataviz-sdk/packages/api-client/src/client'; -import { fromCatalog } from '../../../ods-dataviz-sdk/packages/api-client/src/odsql'; +import {ApiClient} from '../../../ods-dataviz-sdk/packages/api-client/src/client'; +import {fromCatalog} from '../../../ods-dataviz-sdk/packages/api-client/src/odsql'; -const getDatasets = async(domainid) => { - if (!domainid) return { datasets: [] }; - const client = new ApiClient({ domain: domainid }); +const getDatasets = async (domainid) => { + if (!domainid) return {datasets: []}; + const client = new ApiClient({domain: domainid}); const query = fromCatalog() .datasets() .limit(10) @@ -15,9 +15,9 @@ const getDatasets = async(domainid) => { }); }; -const getRecords = async(domainid, datasetid, search = "", refine = {}) => { +const getRecords = async (domainid, datasetid, search = "", refine = {}) => { // refine : { 'fieldid' : 'valeur du refine' } - const client = new ApiClient({ domain: domainid }); + const client = new ApiClient({domain: domainid}); let query = fromCatalog().dataset(datasetid).records().limit(40); let keys = Object.keys(refine); for (let i = 0; i < keys.length; i += 1) { @@ -33,9 +33,9 @@ const getRecords = async(domainid, datasetid, search = "", refine = {}) => { }); }; -const getGeojson = async(domainid, datasetid, search = "", refine = {}, limit = 100) => { +const getGeojson = async (domainid, datasetid, search = "", refine = {}, limit = 100) => { // refine : { 'fieldid' : 'valeur du refine' } - const client = new ApiClient({ domain: domainid }); + const client = new ApiClient({domain: domainid}); let query = fromCatalog().dataset(datasetid).exports('geojson').limit(limit); let keys = Object.keys(refine); for (let i = 0; i < keys.length; i += 1) { @@ -51,8 +51,8 @@ const getGeojson = async(domainid, datasetid, search = "", refine = {}, limit = }); }; -const getFilterCategories = async(domainid, datasetid, search = "", field, refine = {}) => { - const client = new ApiClient({ domain: domainid }); +const getFilterCategories = async (domainid, datasetid, search = "", field, refine = {}) => { + const client = new ApiClient({domain: domainid}); let query = fromCatalog() .dataset(datasetid) .records() @@ -73,8 +73,30 @@ const getFilterCategories = async(domainid, datasetid, search = "", field, refin }); }; -const getAggregates = async(domainid, datasetid, search = "", field, refine = {}, expression) => { - const client = new ApiClient({ domain: domainid }); +const getFacets = async (domainid, datasetid, search = "", field, refine = {}) => { + const client = new ApiClient({domain: domainid}); + let query = fromCatalog() + .dataset(datasetid) + .facets() + .facet(field); + let keys = Object.keys(refine); + for (let i = 0; i < keys.length; i += 1) { + if (keys[i] != field) { + query = query.refine(`${keys[i]}:"${refine[keys[i]]}"`); + } + } + if (search) { + query = query.where(`"${search}"`); + } + return client.get(query) + .then(res => res) + .catch(err => { + throw err; + }); +}; + +const getAggregates = async (domainid, datasetid, search = "", field, refine = {}, expression) => { + const client = new ApiClient({domain: domainid}); let query = fromCatalog() .dataset(datasetid) .records() @@ -90,7 +112,7 @@ const getAggregates = async(domainid, datasetid, search = "", field, refine = {} if (field) { query = query.groupBy(field); } - + return client.get(query) .then(res => res) .catch(err => { @@ -98,7 +120,7 @@ const getAggregates = async(domainid, datasetid, search = "", field, refine = {} }); }; -const getNext = async(links) => { +const getNext = async (links) => { let href; links.forEach(element => { if (element.rel == 'next') @@ -112,4 +134,4 @@ const getNext = async(links) => { }); } -export default { getRecords, getGeojson, getDatasets, getNext, getFilterCategories, getAggregates } \ No newline at end of file +export default {getRecords, getGeojson, getDatasets, getNext, getFilterCategories, getAggregates, getFacets} \ No newline at end of file From 33d244b780896969c2b7a2098a70be2eebd6a7ec Mon Sep 17 00:00:00 2001 From: Manon Dravet Date: Mon, 10 Jan 2022 15:26:49 +0100 Subject: [PATCH 05/11] creation nouvelle page avec composants --- package-lock.json | 14 +++---- package.json | 2 +- src/pages/mynewpage.svelte | 86 ++++++++++++++++++++++++++++++++++++++ src/utilities/ods.js | 4 +- 4 files changed, 96 insertions(+), 10 deletions(-) create mode 100644 src/pages/mynewpage.svelte diff --git a/package-lock.json b/package-lock.json index 56ed32d..414af96 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "svelte-select": "^4.4.6" }, "devDependencies": { - "@opendatasoft/api-client": "^0.2.0", + "@opendatasoft/api-client": "^0.3.2", "@roxi/routify": "^2.18.3", "@sveltejs/vite-plugin-svelte": "^1.0.0-next.5", "autoprefixer": "^10.2.5", @@ -204,9 +204,9 @@ } }, "node_modules/@opendatasoft/api-client": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@opendatasoft/api-client/-/api-client-0.2.0.tgz", - "integrity": "sha512-2875IbCkRI3xk5jyrYLecEeN91//rs+16iLB7KiOhTvs/0kJTQmC9IY5VVVbG63SzUDeSij74ACFziYTqUg9Kg==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@opendatasoft/api-client/-/api-client-0.3.2.tgz", + "integrity": "sha512-W3MuTZd9NSJn32zvz/AOBQVObsCTg5iq5MBN/95d3D/dD3Ee/r6o7Xwe26v1iWLVmkIqFzt1s23cZLGSSQt3KA==", "dev": true, "dependencies": { "immutability-helper": "^3.1.1" @@ -3944,9 +3944,9 @@ } }, "@opendatasoft/api-client": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@opendatasoft/api-client/-/api-client-0.2.0.tgz", - "integrity": "sha512-2875IbCkRI3xk5jyrYLecEeN91//rs+16iLB7KiOhTvs/0kJTQmC9IY5VVVbG63SzUDeSij74ACFziYTqUg9Kg==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@opendatasoft/api-client/-/api-client-0.3.2.tgz", + "integrity": "sha512-W3MuTZd9NSJn32zvz/AOBQVObsCTg5iq5MBN/95d3D/dD3Ee/r6o7Xwe26v1iWLVmkIqFzt1s23cZLGSSQt3KA==", "dev": true, "requires": { "immutability-helper": "^3.1.1" diff --git a/package.json b/package.json index 87badcd..bb8a4fd 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "build:vite": "vite build" }, "devDependencies": { - "@opendatasoft/api-client": "^0.2.0", + "@opendatasoft/api-client": "^0.3.2", "@roxi/routify": "^2.18.3", "@sveltejs/vite-plugin-svelte": "^1.0.0-next.5", "autoprefixer": "^10.2.5", diff --git a/src/pages/mynewpage.svelte b/src/pages/mynewpage.svelte new file mode 100644 index 0000000..2a9d165 --- /dev/null +++ b/src/pages/mynewpage.svelte @@ -0,0 +1,86 @@ + + +
+

My new Page title

+

Here is a description

+
+ +
+
+ + +
+
+ + + {#each config.filters as filter} + + {/each} +
+ + + + + diff --git a/src/utilities/ods.js b/src/utilities/ods.js index 3920baa..812bc8a 100644 --- a/src/utilities/ods.js +++ b/src/utilities/ods.js @@ -1,5 +1,5 @@ -import {ApiClient} from '../../../ods-dataviz-sdk/packages/api-client/src/client'; -import {fromCatalog} from '../../../ods-dataviz-sdk/packages/api-client/src/odsql'; +import {ApiClient} from '@opendatasoft/api-client/src/client'; +import {fromCatalog} from '@opendatasoft/api-client/src/odsql'; const getDatasets = async (domainid) => { if (!domainid) return {datasets: []}; From ab96d00af08ce701330402922a074a339e61b59b Mon Sep 17 00:00:00 2001 From: Manon Dravet Date: Mon, 10 Jan 2022 17:40:44 +0100 Subject: [PATCH 06/11] =?UTF-8?q?test=20css=20pass=C3=A9=20dans=20parent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Table.svelte | 3 +- src/pages/mynewpage.svelte | 39 ++++++++++++++----------- src/pages/querycomponents.svelte | 50 +++++++++++++++++--------------- 3 files changed, 51 insertions(+), 41 deletions(-) diff --git a/src/components/Table.svelte b/src/components/Table.svelte index 6d227bc..d63a78d 100644 --- a/src/components/Table.svelte +++ b/src/components/Table.svelte @@ -1,9 +1,10 @@ -
+
diff --git a/src/pages/mynewpage.svelte b/src/pages/mynewpage.svelte index 2a9d165..123ecf4 100644 --- a/src/pages/mynewpage.svelte +++ b/src/pages/mynewpage.svelte @@ -17,26 +17,32 @@
-
- +
+ + +
+
-
- + - {#each config.filters as filter} - - {/each} + {#each config.filters as filter} + + {/each}
- - + diff --git a/src/pages/querycomponents.svelte b/src/pages/querycomponents.svelte index 9af7cce..2f59d98 100644 --- a/src/pages/querycomponents.svelte +++ b/src/pages/querycomponents.svelte @@ -1,35 +1,38 @@
-
- -
- {#each config.filters as filter} - - {/each} -
+
+ +
+ {#each config.filters as filter} + + {/each}
- -
+ + +
+ \ No newline at end of file diff --git a/src/global.scss b/src/global.scss index 474420e..05d5028 100644 --- a/src/global.scss +++ b/src/global.scss @@ -31,4 +31,13 @@ a { } @tailwind components; -@tailwind utilities; \ No newline at end of file +@tailwind utilities; + +.ol-control.layer-switcher { + bottom: 10px; + left: 10px; + + button { + display: none; + } +} \ No newline at end of file diff --git a/src/pages/map.svelte b/src/pages/map.svelte index 56bd51c..7206c32 100644 --- a/src/pages/map.svelte +++ b/src/pages/map.svelte @@ -8,7 +8,7 @@ import Searchbar from "../components/Searchbar.svelte"; import {onMount} from "svelte"; - import {Feature, Map, View} from 'ol'; + import {Feature, Map, Overlay, View} from 'ol'; import TileLayer from 'ol/layer/Tile'; import OSM from 'ol/source/OSM'; import VectorLayer from "ol/layer/Vector"; @@ -42,6 +42,11 @@ let clusterHulls; let clusters; + let overlay; + let tooltip; + let tooltipCloseButton; + let tooltipContent; + const circleDistanceMultiplier = 1; const circleFootSeparation = 28; const circleStartAngle = Math.PI / 2; @@ -82,6 +87,7 @@ width: 2.5, }); + /** * Single feature style, users for clusters with 1 feature and cluster circles. * @param {Feature} clusterMember A feature from a cluster. @@ -294,11 +300,18 @@ }); }, 500); + function setPopup(event, feature) { + const clickCoordinates = event.coordinates; + tooltipContent.innerHTML = `

${feature.get('insnom')}


${feature.get('equnom')}

`; + overlay.setPosition(clickCoordinates); + console.log(tooltip); + } + onMount(() => { mapView = new View({ center: fromLonLat([2.0, 48.0]), zoom: 7, - maxZoom: 18 + maxZoom: 13 }) map = new Map({ @@ -353,6 +366,8 @@ // Zoom to the extent of the cluster members. view.fit(extent, {duration: 500, padding: [50, 50, 50, 50]}); } + } else { + setPopup(event, clusterMembers[0]) } } }); @@ -360,6 +375,23 @@ }); debouncedRefresh(); + + overlay = new Overlay({ + element: tooltip, + autoPan: { + animation: { + duration: 250, + }, + }, + }); + + map.addOverlay(overlay); + + tooltipCloseButton.onclick = function () { + overlay.setPosition(undefined); + tooltipCloseButton.blur(); + return false; + }; }); @@ -395,6 +427,13 @@
+ +
+ +
+ Overlay content +
+
diff --git a/src/pages/withstore.svelte b/src/pages/withstore.svelte new file mode 100644 index 0000000..c370ffb --- /dev/null +++ b/src/pages/withstore.svelte @@ -0,0 +1,23 @@ + + +
+ + +
+ diff --git a/src/stores/datasetContext.js b/src/stores/datasetContext.js new file mode 100644 index 0000000..909e8b6 --- /dev/null +++ b/src/stores/datasetContext.js @@ -0,0 +1,29 @@ +import {writable} from 'svelte/store'; + +function createDatasetContext() { + const {subscribe, set, update} = writable({}); + + const defaultParameters = { + limit: 20, + offset: 0 + } + + return { + subscribe, + init: (domain, dataset, parameters = defaultParameters) => set({ + 'domain': domain, + 'dataset': dataset, + 'parameters': parameters + }), + setQuery: (q) => update(dc => { + dc.parameters['q'] = q; + return dc; + }), + refine: (k, v) => update(dc => { + dc.parameters['refines'][k] = v; + return dc; + }) + }; +} + +export const datasetContext = createDatasetContext(); \ No newline at end of file diff --git a/src/stores/datasetRecords.js b/src/stores/datasetRecords.js new file mode 100644 index 0000000..2f04549 --- /dev/null +++ b/src/stores/datasetRecords.js @@ -0,0 +1,48 @@ +import {derived} from 'svelte/store'; +import {ApiClient} from "@opendatasoft/api-client/src/client/index"; +import {fromCatalog} from "@opendatasoft/api-client/src/odsql/index"; + +const __getRecords = (datasetContext, set) => { + if (datasetContext.domain) { + const client = new ApiClient({domain: datasetContext.domain}); + let query = fromCatalog() + .dataset(datasetContext.dataset) + .records() + .limit(datasetContext.parameters.limit) + .offset(datasetContext.parameters.offset); + let keys = Object.keys(datasetContext.parameters.refine || {}); + for (let i = 0; i < keys.length; i += 1) { + query = query.refine(`${keys[i]}:"${datasetContext.parameters.refine[keys[i]]}"`); + } + if (datasetContext.parameters['q']) { + query = query.where(`"${datasetContext.parameters['q']}"`) + } + client.get(query) + .then(res => res) + .then(res => { + console.log(`Set ${res.records.length} records`); + set(res.records) + }) + .catch((err) => console.log(err)); + } +} + +// export const datasetRecords = derived(datasetContext, ($datasetContext, set) => { +// let timeoutId = setTimeout(() => { +// __getRecords($datasetContext, set); +// }, 300); +// return () => { +// clearTimeout(timeoutId); +// } +// }, []); + +export default (datasetContext) => { + return derived(datasetContext, ($datasetContext, set) => { + let timeoutId = setTimeout(() => { + __getRecords($datasetContext, set); + }, 300); + return () => { + clearTimeout(timeoutId); + } + }, []); +} \ No newline at end of file diff --git a/src/stores/datasetStore.js b/src/stores/datasetStore.js new file mode 100644 index 0000000..9c3c55e --- /dev/null +++ b/src/stores/datasetStore.js @@ -0,0 +1,80 @@ +import {derived, get, writable} from 'svelte/store'; +import {ApiClient} from "@opendatasoft/api-client/src/client/index"; +import {fromCatalog} from "@opendatasoft/api-client/src/odsql/index"; + +const defaultParameters = { + limit: 20, + offset: 0 +} + +const __getRecords = (domain, dataset, parameters, set) => { + if (domain) { + const client = new ApiClient({domain: domain}); + let query = fromCatalog() + .dataset(dataset) + .records() + .limit(parameters.limit) + .offset(parameters.offset); + let keys = Object.keys(parameters.refine || {}); + for (let i = 0; i < keys.length; i += 1) { + query = query.refine(`${keys[i]}:"${parameters.refine[keys[i]]}"`); + } + if (parameters['q']) { + query = query.where(`"${parameters['q']}"`) + } + client.get(query) + .then(res => res) + .then(res => { + console.log(`Set ${res.records.length} records`); + set(res.records) + }) + .catch((err) => console.log(err)); + } +} + +class DatasetStore { + constructor(domain, dataset, parameters = {}) { + this.domain = writable(domain); + this.dataset = writable(dataset); + this.parameters = writable(Object.assign({}, defaultParameters, parameters)); + this.records = []; + } + + id = undefined; + + setQuery = (q) => { + if (this.id) { + clearTimeout(this.id); + } + this.id = setTimeout(() => { + console.log("set query"); + this.parameters.update(param => { + param['q'] = q; + return param; + }) + clearTimeout(this.id); + }, 500); + + } + + refine = (k, v) => { + this.parameters.update(param => { + if (!param.hasOwnProperty('refine')) + param['refine'] = {}; + param['refine'][k] = v; + return param; + }) + } + + getRecordsStore = () => { + return derived([this.domain, this.dataset, this.parameters], + ([$domain, $dataset, $parameters], set) => { + console.log('call derived', $domain, $dataset, JSON.stringify($parameters)); + __getRecords($domain, $dataset, $parameters, set); + return () => { + } + }, []); + } +} + +export default DatasetStore; \ No newline at end of file diff --git a/vite.config.js b/vite.config.js index 820465f..9acb80e 100644 --- a/vite.config.js +++ b/vite.config.js @@ -3,7 +3,7 @@ import { defineConfig } from 'vite'; export default defineConfig({ server: { - port: 5000, + port: 9001, }, plugins: [svelte()], From 457d3b02c98d29484b0d630fecaccdea0bfb687a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Passaniti?= Date: Tue, 18 Jan 2022 23:17:31 +0100 Subject: [PATCH 09/11] Maplibre first components and tests --- package-lock.json | 324 ++++++++++++++++++++++- package.json | 4 +- src/App.svelte | 2 +- src/components/Maplibre.svelte | 46 ++++ src/components/MaplibreSource.svelte | 45 ++++ src/components/MaplibreStyleLayer.svelte | 29 ++ src/pages/withstore.svelte | 8 + src/pages/withstore_map.svelte | 47 ++++ src/stores/datasetStore.js | 87 +++++- src/utilities/mapUtilities.js | 12 + 10 files changed, 587 insertions(+), 17 deletions(-) create mode 100644 src/components/Maplibre.svelte create mode 100644 src/components/MaplibreSource.svelte create mode 100644 src/components/MaplibreStyleLayer.svelte create mode 100644 src/pages/withstore_map.svelte create mode 100644 src/utilities/mapUtilities.js diff --git a/package-lock.json b/package-lock.json index 9922867..e9d310c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,11 +11,13 @@ "svelte-select": "^4.4.6" }, "devDependencies": { - "@opendatasoft/api-client": "^0.3.2", + "@gouvfr/dsfr": "^1.2.1", + "@opendatasoft/api-client": "latest", "@roxi/routify": "^2.18.3", "@sveltejs/vite-plugin-svelte": "^1.0.0-next.5", "autoprefixer": "^10.2.5", "lodash": "^4.17.21", + "maplibre-gl": "^2.0.1", "npm-run-all": "^4.1.5", "ol": "^6.10.0", "ol-layerswitcher": "^3.8.3", @@ -127,6 +129,28 @@ "node": ">=4" } }, + "node_modules/@gouvfr/dsfr": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@gouvfr/dsfr/-/dsfr-1.2.1.tgz", + "integrity": "sha512-vnpeX+fZnW2KLl2PrcjHpUhOuO7twT9h3gwZvJLgVl+IosM4/Jesx5QMZAhsLl85Cq57mKhSjTnw8EZglLanUg==", + "dev": true, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/@mapbox/geojson-rewind": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@mapbox/geojson-rewind/-/geojson-rewind-0.5.1.tgz", + "integrity": "sha512-eL7fMmfTBKjrb+VFHXCGv9Ot0zc3C0U+CwXo1IrP+EPwDczLoXv34Tgq3y+2mPSFNVUXgU42ILWJTC7145KPTA==", + "dev": true, + "dependencies": { + "get-stream": "^6.0.1", + "minimist": "^1.2.5" + }, + "bin": { + "geojson-rewind": "geojson-rewind" + } + }, "node_modules/@mapbox/jsonlint-lines-primitives": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/@mapbox/jsonlint-lines-primitives/-/jsonlint-lines-primitives-2.0.2.tgz", @@ -158,18 +182,48 @@ "gl-style-validate": "bin/gl-style-validate" } }, + "node_modules/@mapbox/mapbox-gl-supported": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-supported/-/mapbox-gl-supported-2.0.1.tgz", + "integrity": "sha512-HP6XvfNIzfoMVfyGjBckjiAOQK9WfX0ywdLubuPMPv+Vqf5fj0uCbgBQYpiqcWZT6cbyyRnTSXDheT1ugvF6UQ==", + "dev": true + }, "node_modules/@mapbox/point-geometry": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz", "integrity": "sha1-ioP5M1x4YO/6Lu7KJUMyqgru2PI=", "dev": true }, + "node_modules/@mapbox/tiny-sdf": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@mapbox/tiny-sdf/-/tiny-sdf-2.0.4.tgz", + "integrity": "sha512-CBtL2rhZiYmdIryksp0zh4Mmx54iClYfNb0mpYeHrZnq4z84lVjre7LBWGPEjWspEn6AiF0lxC1HaZDye89m3g==", + "dev": true + }, "node_modules/@mapbox/unitbezier": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/@mapbox/unitbezier/-/unitbezier-0.0.0.tgz", "integrity": "sha1-FWUb1VOme4WB+zmIEMmK2Go0Uk4=", "dev": true }, + "node_modules/@mapbox/vector-tile": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@mapbox/vector-tile/-/vector-tile-1.3.1.tgz", + "integrity": "sha512-MCEddb8u44/xfQ3oD+Srl/tNcQoqTw3goGk2oLsrFxOTc3dUp+kAnby3PvAeeBYSMSjSPD1nd1AJA6W49WnoUw==", + "dev": true, + "dependencies": { + "@mapbox/point-geometry": "~0.1.0" + } + }, + "node_modules/@mapbox/whoots-js": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@mapbox/whoots-js/-/whoots-js-3.1.0.tgz", + "integrity": "sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -1010,6 +1064,12 @@ "node": ">=10" } }, + "node_modules/earcut": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.3.tgz", + "integrity": "sha512-iRDI1QeCQIhMCZk48DRDMVgQSSBDmbzzNhnxIo+pwx3swkfjMh6vh0nWLq1NdvGHLKH6wIrAM3vQWeTj6qeoug==", + "dev": true + }, "node_modules/electron-to-chromium": { "version": "1.3.827", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.827.tgz", @@ -1280,6 +1340,12 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, + "node_modules/geojson-vt": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/geojson-vt/-/geojson-vt-3.2.1.tgz", + "integrity": "sha512-EvGQQi/zPrDA6zr6BnJD/YhwAkBP8nnJ9emh3EnHQKVMfg/MRVtPbMYdgVy/IaEmn4UfagD2a6fafPDL5hbtwg==", + "dev": true + }, "node_modules/geotiff": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/geotiff/-/geotiff-1.0.9.tgz", @@ -1313,6 +1379,24 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/gl-matrix": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/gl-matrix/-/gl-matrix-3.4.3.tgz", + "integrity": "sha512-wcCp8vu8FT22BnvKVPjXa/ICBWRq/zjFfdofZy1WSpQZpphblv12/bOQLBC1rMM7SGOFS9ltVmKOHil5+Ml7gA==", + "dev": true + }, "node_modules/glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", @@ -1351,6 +1435,12 @@ "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", "dev": true }, + "node_modules/grid-index": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/grid-index/-/grid-index-1.1.0.tgz", + "integrity": "sha512-HZRwumpOGUrHyxO5bqKZL0B0GlUpwtCAzZ42sgxUPniu33R1LSFH5yrIcBCHjkctCAh3mtWKcKd9J4vDDdeVHA==", + "dev": true + }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -1905,6 +1995,12 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/kdbush": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/kdbush/-/kdbush-3.0.0.tgz", + "integrity": "sha512-hRkd6/XW4HTsA9vjVpY9tuXJYLSlelnkTmVFu4M9/7MIYQtFcHpbugAU7UbOfjOiVSVYl2fqgBuJ32JUmRo5Ew==", + "dev": true + }, "node_modules/kleur": { "version": "4.1.4", "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.4.tgz", @@ -2085,6 +2181,42 @@ "integrity": "sha512-v674D0WtpxCXlA6E+sBlG1QJWdUkz/s9qAD91bJSXBGuBL5lL4tJXpoJEftecphCh2SVQCjWMS2vhylc3AIQTg==", "dev": true }, + "node_modules/maplibre-gl": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-2.0.1.tgz", + "integrity": "sha512-IWfykU9K9JPUqG15WqarRSuAb2nxvZZPezaxg2pLOJ1XAXJzR4lykZrBkyUi2Y1avd8ehJs8rkZJgneqnrWWXg==", + "dev": true, + "dependencies": { + "@mapbox/geojson-rewind": "^0.5.0", + "@mapbox/jsonlint-lines-primitives": "^2.0.2", + "@mapbox/mapbox-gl-supported": "^2.0.1", + "@mapbox/tiny-sdf": "^2.0.4", + "@mapbox/unitbezier": "^0.0.1", + "@mapbox/vector-tile": "^1.3.1", + "@mapbox/whoots-js": "^3.1.0", + "csscolorparser": "~1.0.3", + "earcut": "^2.2.2", + "geojson-vt": "^3.2.1", + "gl-matrix": "^3.2.1", + "grid-index": "^1.1.0", + "murmurhash-js": "^1.0.0", + "pbf": "^3.2.1", + "potpack": "^1.0.1", + "quickselect": "^2.0.0", + "supercluster": "^7.1.0", + "tinyqueue": "^2.0.3", + "vt-pbf": "^3.1.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/maplibre-gl/node_modules/@mapbox/unitbezier": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@mapbox/unitbezier/-/unitbezier-0.0.1.tgz", + "integrity": "sha512-nMkuDXFv60aBr9soUG5q+GvZYL+2KZHVvsqFCzqnkGEf46U2fvmytHaEVc1/YZbiLn8X+eR3QzX1+dwDO1lxlw==", + "dev": true + }, "node_modules/memorystream": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", @@ -2187,6 +2319,12 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "node_modules/murmurhash-js": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/murmurhash-js/-/murmurhash-js-1.0.0.tgz", + "integrity": "sha1-sGJ44h/Gw3+lMTcysEEry2rhX1E=", + "dev": true + }, "node_modules/nanoid": { "version": "3.1.25", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz", @@ -2726,6 +2864,12 @@ "integrity": "sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==", "dev": true }, + "node_modules/potpack": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/potpack/-/potpack-1.0.2.tgz", + "integrity": "sha512-choctRBIV9EMT9WGAZHn3V7t0Z2pMQyl0EZE6pFc/6ml3ssw7Dlf/oAOvFwjm1HVsqfQN8GfeFyJ+d8tRzqueQ==", + "dev": true + }, "node_modules/prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", @@ -3282,6 +3426,15 @@ "node": ">=8" } }, + "node_modules/supercluster": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/supercluster/-/supercluster-7.1.4.tgz", + "integrity": "sha512-GhKkRM1jMR6WUwGPw05fs66pOFWhf59lXq+Q3J3SxPvhNcmgOtLRV6aVQPMRsmXdpaeFJGivt+t7QXUPL3ff4g==", + "dev": true, + "dependencies": { + "kdbush": "^3.0.0" + } + }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -3501,6 +3654,12 @@ "esm": "^3.2.25" } }, + "node_modules/tinyqueue": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/tinyqueue/-/tinyqueue-2.0.3.tgz", + "integrity": "sha512-ppJZNDuKGgxzkHihX8v9v9G5f+18gzaTfrukGrq6ueg0lmH4nqVnA2IPG0AEH3jKEk2GRJCUhDoqpoiw3PHLBA==", + "dev": true + }, "node_modules/tmp": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", @@ -3643,6 +3802,17 @@ "fsevents": "~2.3.2" } }, + "node_modules/vt-pbf": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/vt-pbf/-/vt-pbf-3.1.3.tgz", + "integrity": "sha512-2LzDFzt0mZKZ9IpVF2r69G9bXaP2Q2sArJCmcCgvfTdCCZzSyz4aCLoQyUilu37Ll56tCblIZrXFIjNUpGIlmA==", + "dev": true, + "dependencies": { + "@mapbox/point-geometry": "0.1.0", + "@mapbox/vector-tile": "^1.3.1", + "pbf": "^3.2.1" + } + }, "node_modules/w3c-hr-time": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", @@ -3894,6 +4064,22 @@ } } }, + "@gouvfr/dsfr": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@gouvfr/dsfr/-/dsfr-1.2.1.tgz", + "integrity": "sha512-vnpeX+fZnW2KLl2PrcjHpUhOuO7twT9h3gwZvJLgVl+IosM4/Jesx5QMZAhsLl85Cq57mKhSjTnw8EZglLanUg==", + "dev": true + }, + "@mapbox/geojson-rewind": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@mapbox/geojson-rewind/-/geojson-rewind-0.5.1.tgz", + "integrity": "sha512-eL7fMmfTBKjrb+VFHXCGv9Ot0zc3C0U+CwXo1IrP+EPwDczLoXv34Tgq3y+2mPSFNVUXgU42ILWJTC7145KPTA==", + "dev": true, + "requires": { + "get-stream": "^6.0.1", + "minimist": "^1.2.5" + } + }, "@mapbox/jsonlint-lines-primitives": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/@mapbox/jsonlint-lines-primitives/-/jsonlint-lines-primitives-2.0.2.tgz", @@ -3916,18 +4102,45 @@ "sort-object": "^0.3.2" } }, + "@mapbox/mapbox-gl-supported": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-supported/-/mapbox-gl-supported-2.0.1.tgz", + "integrity": "sha512-HP6XvfNIzfoMVfyGjBckjiAOQK9WfX0ywdLubuPMPv+Vqf5fj0uCbgBQYpiqcWZT6cbyyRnTSXDheT1ugvF6UQ==", + "dev": true + }, "@mapbox/point-geometry": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz", "integrity": "sha1-ioP5M1x4YO/6Lu7KJUMyqgru2PI=", "dev": true }, + "@mapbox/tiny-sdf": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@mapbox/tiny-sdf/-/tiny-sdf-2.0.4.tgz", + "integrity": "sha512-CBtL2rhZiYmdIryksp0zh4Mmx54iClYfNb0mpYeHrZnq4z84lVjre7LBWGPEjWspEn6AiF0lxC1HaZDye89m3g==", + "dev": true + }, "@mapbox/unitbezier": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/@mapbox/unitbezier/-/unitbezier-0.0.0.tgz", "integrity": "sha1-FWUb1VOme4WB+zmIEMmK2Go0Uk4=", "dev": true }, + "@mapbox/vector-tile": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@mapbox/vector-tile/-/vector-tile-1.3.1.tgz", + "integrity": "sha512-MCEddb8u44/xfQ3oD+Srl/tNcQoqTw3goGk2oLsrFxOTc3dUp+kAnby3PvAeeBYSMSjSPD1nd1AJA6W49WnoUw==", + "dev": true, + "requires": { + "@mapbox/point-geometry": "~0.1.0" + } + }, + "@mapbox/whoots-js": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@mapbox/whoots-js/-/whoots-js-3.1.0.tgz", + "integrity": "sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q==", + "dev": true + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -4577,6 +4790,12 @@ "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==", "dev": true }, + "earcut": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.3.tgz", + "integrity": "sha512-iRDI1QeCQIhMCZk48DRDMVgQSSBDmbzzNhnxIo+pwx3swkfjMh6vh0nWLq1NdvGHLKH6wIrAM3vQWeTj6qeoug==", + "dev": true + }, "electron-to-chromium": { "version": "1.3.827", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.827.tgz", @@ -4774,6 +4993,12 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, + "geojson-vt": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/geojson-vt/-/geojson-vt-3.2.1.tgz", + "integrity": "sha512-EvGQQi/zPrDA6zr6BnJD/YhwAkBP8nnJ9emh3EnHQKVMfg/MRVtPbMYdgVy/IaEmn4UfagD2a6fafPDL5hbtwg==", + "dev": true + }, "geotiff": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/geotiff/-/geotiff-1.0.9.tgz", @@ -4800,6 +5025,18 @@ "has-symbols": "^1.0.1" } }, + "get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true + }, + "gl-matrix": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/gl-matrix/-/gl-matrix-3.4.3.tgz", + "integrity": "sha512-wcCp8vu8FT22BnvKVPjXa/ICBWRq/zjFfdofZy1WSpQZpphblv12/bOQLBC1rMM7SGOFS9ltVmKOHil5+Ml7gA==", + "dev": true + }, "glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", @@ -4829,6 +5066,12 @@ "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", "dev": true }, + "grid-index": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/grid-index/-/grid-index-1.1.0.tgz", + "integrity": "sha512-HZRwumpOGUrHyxO5bqKZL0B0GlUpwtCAzZ42sgxUPniu33R1LSFH5yrIcBCHjkctCAh3mtWKcKd9J4vDDdeVHA==", + "dev": true + }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -5232,6 +5475,12 @@ "universalify": "^2.0.0" } }, + "kdbush": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/kdbush/-/kdbush-3.0.0.tgz", + "integrity": "sha512-hRkd6/XW4HTsA9vjVpY9tuXJYLSlelnkTmVFu4M9/7MIYQtFcHpbugAU7UbOfjOiVSVYl2fqgBuJ32JUmRo5Ew==", + "dev": true + }, "kleur": { "version": "4.1.4", "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.4.tgz", @@ -5383,6 +5632,41 @@ "integrity": "sha512-v674D0WtpxCXlA6E+sBlG1QJWdUkz/s9qAD91bJSXBGuBL5lL4tJXpoJEftecphCh2SVQCjWMS2vhylc3AIQTg==", "dev": true }, + "maplibre-gl": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-2.0.1.tgz", + "integrity": "sha512-IWfykU9K9JPUqG15WqarRSuAb2nxvZZPezaxg2pLOJ1XAXJzR4lykZrBkyUi2Y1avd8ehJs8rkZJgneqnrWWXg==", + "dev": true, + "requires": { + "@mapbox/geojson-rewind": "^0.5.0", + "@mapbox/jsonlint-lines-primitives": "^2.0.2", + "@mapbox/mapbox-gl-supported": "^2.0.1", + "@mapbox/tiny-sdf": "^2.0.4", + "@mapbox/unitbezier": "^0.0.1", + "@mapbox/vector-tile": "^1.3.1", + "@mapbox/whoots-js": "^3.1.0", + "csscolorparser": "~1.0.3", + "earcut": "^2.2.2", + "geojson-vt": "^3.2.1", + "gl-matrix": "^3.2.1", + "grid-index": "^1.1.0", + "murmurhash-js": "^1.0.0", + "pbf": "^3.2.1", + "potpack": "^1.0.1", + "quickselect": "^2.0.0", + "supercluster": "^7.1.0", + "tinyqueue": "^2.0.3", + "vt-pbf": "^3.1.1" + }, + "dependencies": { + "@mapbox/unitbezier": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@mapbox/unitbezier/-/unitbezier-0.0.1.tgz", + "integrity": "sha512-nMkuDXFv60aBr9soUG5q+GvZYL+2KZHVvsqFCzqnkGEf46U2fvmytHaEVc1/YZbiLn8X+eR3QzX1+dwDO1lxlw==", + "dev": true + } + } + }, "memorystream": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", @@ -5458,6 +5742,12 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "murmurhash-js": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/murmurhash-js/-/murmurhash-js-1.0.0.tgz", + "integrity": "sha1-sGJ44h/Gw3+lMTcysEEry2rhX1E=", + "dev": true + }, "nanoid": { "version": "3.1.25", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz", @@ -5853,6 +6143,12 @@ "integrity": "sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==", "dev": true }, + "potpack": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/potpack/-/potpack-1.0.2.tgz", + "integrity": "sha512-choctRBIV9EMT9WGAZHn3V7t0Z2pMQyl0EZE6pFc/6ml3ssw7Dlf/oAOvFwjm1HVsqfQN8GfeFyJ+d8tRzqueQ==", + "dev": true + }, "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", @@ -6283,6 +6579,15 @@ "min-indent": "^1.0.0" } }, + "supercluster": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/supercluster/-/supercluster-7.1.4.tgz", + "integrity": "sha512-GhKkRM1jMR6WUwGPw05fs66pOFWhf59lXq+Q3J3SxPvhNcmgOtLRV6aVQPMRsmXdpaeFJGivt+t7QXUPL3ff4g==", + "dev": true, + "requires": { + "kdbush": "^3.0.0" + } + }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -6422,6 +6727,12 @@ "esm": "^3.2.25" } }, + "tinyqueue": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/tinyqueue/-/tinyqueue-2.0.3.tgz", + "integrity": "sha512-ppJZNDuKGgxzkHihX8v9v9G5f+18gzaTfrukGrq6ueg0lmH4nqVnA2IPG0AEH3jKEk2GRJCUhDoqpoiw3PHLBA==", + "dev": true + }, "tmp": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", @@ -6533,6 +6844,17 @@ "rollup": "^2.38.5" } }, + "vt-pbf": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/vt-pbf/-/vt-pbf-3.1.3.tgz", + "integrity": "sha512-2LzDFzt0mZKZ9IpVF2r69G9bXaP2Q2sArJCmcCgvfTdCCZzSyz4aCLoQyUilu37Ll56tCblIZrXFIjNUpGIlmA==", + "dev": true, + "requires": { + "@mapbox/point-geometry": "0.1.0", + "@mapbox/vector-tile": "^1.3.1", + "pbf": "^3.2.1" + } + }, "w3c-hr-time": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", diff --git a/package.json b/package.json index bdf82a2..6035320 100644 --- a/package.json +++ b/package.json @@ -11,11 +11,13 @@ "build:vite": "vite build" }, "devDependencies": { - "@opendatasoft/api-client": "^0.3.2", + "@gouvfr/dsfr": "^1.2.1", + "@opendatasoft/api-client": "latest", "@roxi/routify": "^2.18.3", "@sveltejs/vite-plugin-svelte": "^1.0.0-next.5", "autoprefixer": "^10.2.5", "lodash": "^4.17.21", + "maplibre-gl": "^2.0.1", "npm-run-all": "^4.1.5", "ol": "^6.10.0", "ol-layerswitcher": "^3.8.3", diff --git a/src/App.svelte b/src/App.svelte index 7f7313b..ed88e91 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -3,4 +3,4 @@ import { routes } from "../.routify/routes"; - \ No newline at end of file + diff --git a/src/components/Maplibre.svelte b/src/components/Maplibre.svelte new file mode 100644 index 0000000..83146e5 --- /dev/null +++ b/src/components/Maplibre.svelte @@ -0,0 +1,46 @@ + + + + + + +
+ {#if map} + + {/if} +
+ + \ No newline at end of file diff --git a/src/components/MaplibreSource.svelte b/src/components/MaplibreSource.svelte new file mode 100644 index 0000000..dec4689 --- /dev/null +++ b/src/components/MaplibreSource.svelte @@ -0,0 +1,45 @@ + + +{#if sourceReady} + +{/if} \ No newline at end of file diff --git a/src/components/MaplibreStyleLayer.svelte b/src/components/MaplibreStyleLayer.svelte new file mode 100644 index 0000000..0cb2d8c --- /dev/null +++ b/src/components/MaplibreStyleLayer.svelte @@ -0,0 +1,29 @@ + \ No newline at end of file diff --git a/src/pages/withstore.svelte b/src/pages/withstore.svelte index c370ffb..8a706f9 100644 --- a/src/pages/withstore.svelte +++ b/src/pages/withstore.svelte @@ -6,6 +6,7 @@ let data = new DatasetStore(config.domainid, config.datasetid); let records = data.getRecordsStore(); + let naturelibelles = data.getFacetStore("naturelibelle");
@@ -18,6 +19,13 @@ { event.detail ? data.refine("naturelibelle", event.detail.value) : ''}} + on:clear={(event) => { data.unrefine("naturelibelle")}}/>
diff --git a/src/pages/withstore_map.svelte b/src/pages/withstore_map.svelte new file mode 100644 index 0000000..4a00fa9 --- /dev/null +++ b/src/pages/withstore_map.svelte @@ -0,0 +1,47 @@ + + +
+ + +