forked from Ivasoft/geovisio-website
fix/ add new tiles IGN4
This commit is contained in:
@@ -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]]
|
||||
|
||||
@@ -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 }
|
||||
Reference in New Issue
Block a user