forked from Ivasoft/geovisio-website
Merge branch 'fix/ign-tiles-fallback' into 'main'
fix/ign-tiles-fallback See merge request geovisio/website!125
This commit is contained in:
@@ -1,21 +1,29 @@
|
||||
import axios from 'axios'
|
||||
|
||||
async function getIgnTiles(): Promise<object> {
|
||||
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']]
|
||||
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'
|
||||
}
|
||||
// Patch tms scheme to xyz to make it compatible for Maplibre GL JS / Mapbox GL JS
|
||||
// Patch num_repetition
|
||||
return data
|
||||
}
|
||||
|
||||
export { getIgnTiles }
|
||||
|
||||
@@ -8,10 +8,8 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import Viewer from '@/components/Viewer.vue'
|
||||
import type ViewerType from '@/components/Viewer.vue'
|
||||
const { t } = useI18n()
|
||||
const viewerRef = ref<InstanceType<typeof ViewerType>>()
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user