fix/ add new tiles IGN4

This commit is contained in:
Jean Andreani
2024-03-18 14:01:01 +00:00
parent 518f06c846
commit ca6619b773
2 changed files with 2 additions and 34 deletions

View File

@@ -7,7 +7,6 @@ import axios from 'axios'
import { onMounted, onUnmounted, ref, computed } from 'vue'
import { useSequenceStore } from '@/store/sequence'
import { Viewer, StandaloneMap } from 'geovisio'
import { getIgnTiles } from '@/utils/mapAndViewer'
import { createUrlLink } from '@/utils'
import {
createLink,
@@ -123,11 +122,10 @@ async function setupViewerMap(tiles: string): Promise<void> {
}
}
if (tiles && tiles.length) {
const style = tiles.includes('wxs.ign.fr') ? await getIgnTiles() : tiles
paramsViewer = {
map: {
...paramsViewer.map,
style
style: tiles
}
}
}
@@ -156,10 +154,9 @@ async function setupMap(tiles: string): Promise<void> {
let paramsMap: MapInterface
paramsMap = { users: [props.userId], minZoom: 7 }
if (tiles && tiles.length) {
const style = tiles.includes('wxs.ign.fr') ? await getIgnTiles() : tiles
paramsMap = {
...paramsMap,
style
style: tiles
}
}
const bbox = [props.bbox[0], props.bbox[1], props.bbox[2], props.bbox[3]]

View File

@@ -1,29 +0,0 @@
import axios from 'axios'
async function getIgnTiles(): Promise<object | string> {
try {
const { data } = await axios.get(
'https://wxs.ign.fr/essentiels/static/vectorTiles/styles/PLAN.IGN/attenue.json'
)
data.sources.plan_ign.scheme = 'xyz'
data.sources.plan_ign.attribution = 'Données cartographiques : © IGN'
const objIndex = data.layers.findIndex(
(el: { id: string }) => el.id === 'toponyme - parcellaire - adresse'
)
data.layers[objIndex].layout = {
...data.layers[objIndex].layout,
'text-field': [
'concat',
['get', 'numero'],
['get', 'indice_de_repetition']
]
}
// Patch tms scheme to xyz to make it compatible for Maplibre GL JS / Mapbox GL JS
// Patch num_repetition
return data
} catch (error) {
return 'https://tile-vect.openstreetmap.fr/styles/basic/style.json'
}
}
export { getIgnTiles }