Merge pull request #7056 from tchak/fix-carto-ign

Correction des cartes IGN
This commit is contained in:
LeSim 2022-03-17 12:07:40 +01:00 committed by GitHub
commit 294cc8a5b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 19 deletions

View file

@ -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';

View file

@ -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()

View file

@ -1,4 +1,4 @@
import { AnyLayer } from 'maplibre-gl';
import type { AnyLayer } from 'maplibre-gl';
const layers: AnyLayer[] = [
{

View file

@ -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 {

View file

@ -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