Merge pull request #7056 from tchak/fix-carto-ign
Correction des cartes IGN
This commit is contained in:
commit
294cc8a5b4
5 changed files with 17 additions and 19 deletions
|
@ -8,7 +8,8 @@ import React, {
|
|||
createContext,
|
||||
useCallback
|
||||
} from 'react';
|
||||
import maplibre, { Map, Style, NavigationControl } from 'maplibre-gl';
|
||||
import maplibre, { Map, NavigationControl } from 'maplibre-gl';
|
||||
import type { Style } from 'maplibre-gl';
|
||||
|
||||
import invariant from 'tiny-invariant';
|
||||
|
||||
|
|
|
@ -3,10 +3,12 @@ import invariant from 'tiny-invariant';
|
|||
|
||||
import cadastreLayers from './layers/cadastre';
|
||||
|
||||
const IGN_TOKEN = 'rc1egnbeoss72hxvd143tbyk'; // ggignore
|
||||
|
||||
function ignServiceURL(layer: string, format = 'image/png') {
|
||||
const url = `https://wxs.ign.fr/${IGN_TOKEN}/geoportail/wmts`;
|
||||
function ignServiceURL(
|
||||
layer: string,
|
||||
env = 'decouverte',
|
||||
format = 'image/png'
|
||||
) {
|
||||
const url = `https://wxs.ign.fr/${env}/geoportail/wmts`;
|
||||
const query =
|
||||
'service=WMTS&request=GetTile&version=1.0.0&tilematrixset=PM&tilematrix={z}&tilecol={x}&tilerow={y}&style=normal';
|
||||
|
||||
|
@ -125,7 +127,10 @@ function buildSources() {
|
|||
.flatMap(({ layers }) => layers.map(([, code]) => code))
|
||||
.map((code) => [
|
||||
getLayerCode(code),
|
||||
rasterSource([ignServiceURL(code)], 'IGN-F/Géoportail/MNHN')
|
||||
rasterSource(
|
||||
[ignServiceURL(code, 'environnement')],
|
||||
'IGN-F/Géoportail/MNHN'
|
||||
)
|
||||
])
|
||||
);
|
||||
}
|
||||
|
@ -210,7 +215,7 @@ export default {
|
|||
url: 'https://openmaptiles.geo.data.gouv.fr/data/france-vector.json'
|
||||
},
|
||||
'photographies-aeriennes': rasterSource(
|
||||
[ignServiceURL('ORTHOIMAGERY.ORTHOPHOTOS', 'image/jpeg')],
|
||||
[ignServiceURL('ORTHOIMAGERY.ORTHOPHOTOS', 'decouverte', 'image/jpeg')],
|
||||
'IGN-F/Géoportail'
|
||||
),
|
||||
cadastre: {
|
||||
|
@ -218,7 +223,7 @@ export default {
|
|||
url: 'https://openmaptiles.geo.data.gouv.fr/data/cadastre.json'
|
||||
},
|
||||
'plan-ign': rasterSource(
|
||||
[ignServiceURL('GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2')],
|
||||
[ignServiceURL('GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2', 'decouverte')],
|
||||
'IGN-F/Géoportail'
|
||||
),
|
||||
...buildSources()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { AnyLayer } from 'maplibre-gl';
|
||||
import type { AnyLayer } from 'maplibre-gl';
|
||||
|
||||
const layers: AnyLayer[] = [
|
||||
{
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
import {
|
||||
LngLatBounds,
|
||||
LngLat,
|
||||
LngLatLike,
|
||||
LngLatBoundsLike
|
||||
} from 'maplibre-gl';
|
||||
import type { LngLat, LngLatLike, LngLatBoundsLike } from 'maplibre-gl';
|
||||
import type { Geometry, FeatureCollection, Feature } from 'geojson';
|
||||
import { LngLatBounds } from 'maplibre-gl';
|
||||
import invariant from 'tiny-invariant';
|
||||
|
||||
export function getBounds(geometry: Geometry): LngLatBoundsLike {
|
||||
|
|
|
@ -105,9 +105,5 @@ Rails.application.configure do
|
|||
# Uncomment if you wish to allow Action Cable access from any origin.
|
||||
# config.action_cable.disable_request_forgery_protection = true
|
||||
|
||||
if ENV['IGN_CARTE_REFERER']
|
||||
config.hosts << ENV['IGN_CARTE_REFERER']
|
||||
end
|
||||
|
||||
config.hosts << ENV.fetch("APP_HOST")
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue