From 88e0115d31c2b798d2f8f81013441edc4919b968 Mon Sep 17 00:00:00 2001 From: indyteo Date: Mon, 18 Sep 2023 11:31:31 +0200 Subject: [PATCH] Workaround to navigate in map without search bar --- .github/workflows/deploy.yml | 2 +- main.js | 33 ++++++++++++++++++++++++++------- package-lock.json | 10 +++++----- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 55d657c..bf8254f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -23,7 +23,7 @@ jobs: - name: "Build App" run: npm run build - name: "Deploy React App to GitHub Pages" - uses: JamesIves/github-pages-deploy-action@4.1.8 + uses: JamesIves/github-pages-deploy-action@4.4.3 with: token: ${{ secrets.GITHUB_TOKEN }} branch: gh-pages diff --git a/main.js b/main.js index fd70fa5..2dbe980 100644 --- a/main.js +++ b/main.js @@ -84,13 +84,32 @@ var wfs = new VectorLayer({ color: 'rgba(0, 0, 255, 0.2)' }), }), + minZoom: 16 }); // Couche WMTS PLAN IGN v2 -var rasterSource = new WMTS({ +var rasterSource1 = new WMTS({ + url: 'https://wxs.ign.fr/essentiels/geoportail/wmts', + layer: 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2', + format: 'image/png', + matrixSet: 'PM', + projection: 'EPSG:3857', + tileGrid: tileGrid, + style: 'normal', + attributions: + '' + + 'IGN', +}); + +var wmts1 = new TileLayer({ + source: rasterSource1, + maxZoom: 16 +}); + +// Couche WMTS ORTHO PHOTO +var rasterSource2 = new WMTS({ url: 'https://wxs.ign.fr/essentiels/geoportail/wmts', - //layer: 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2', - //format: 'image/png' layer: 'ORTHOIMAGERY.ORTHOPHOTOS', format: 'image/jpeg', matrixSet: 'PM', @@ -103,18 +122,18 @@ var rasterSource = new WMTS({ 'information géographique et forestière" alt="IGN">', }); -var wmts = new TileLayer({ - source: rasterSource, +var wmts2 = new TileLayer({ + source: rasterSource2, + minZoom: 16 }); // Map OpenLayers var map = new Map({ - layers: [wmts, wfs], + layers: [wmts1, wmts2, wfs], overlays: [overlay], target: document.getElementById('map'), view: new View({ center: fromLonLat([3.280578, 47.368489]), - minZoom: 16, maxZoom: 20, zoom: 19, }), diff --git a/package-lock.json b/package-lock.json index 11f41b4..e0d04da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2592,11 +2592,6 @@ "node": ">=10.19" } }, - "node_modules/geotiff/node_modules/pako": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", - "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==" - }, "node_modules/get-port": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/get-port/-/get-port-4.2.0.tgz", @@ -3205,6 +3200,11 @@ "integrity": "sha512-9LtiGlPy982CsgxZvJGNNp2/NnrgEr6EAyN3iIEP3/8vd3YLgAZQHbQ75ZrkfBRGrNg37Dk3U6tuVb+B4Xfslg==", "dev": true }, + "node_modules/pako": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", + "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==" + }, "node_modules/parcel": { "version": "2.9.3", "resolved": "https://registry.npmjs.org/parcel/-/parcel-2.9.3.tgz",