chore(ign): update to geoplateforme

This commit is contained in:
Paul Chavard 2023-11-09 16:07:13 +01:00 committed by Colin Darie
parent b1203faa69
commit 163e6f807e
No known key found for this signature in database
GPG key ID: 8C76CADD40253590
2 changed files with 6 additions and 13 deletions

View file

@ -3,12 +3,8 @@ import invariant from 'tiny-invariant';
import cadastreLayers from './layers/cadastre';
function ignServiceURL(
layer: string,
env = 'decouverte',
format = 'image/png'
) {
const url = `https://wxs.ign.fr/${env}/geoportail/wmts`;
function ignServiceURL(layer: string, format = 'image/png') {
const url = `https://data.geopf.fr/wmts`;
const query =
'service=WMTS&request=GetTile&version=1.0.0&tilematrixset=PM&tilematrix={z}&tilecol={x}&tilerow={y}&style=normal';
@ -127,10 +123,7 @@ function buildSources() {
.flatMap(({ layers }) => layers.map(([, code]) => code))
.map((code) => [
getLayerCode(code),
rasterSource(
[ignServiceURL(code, 'environnement')],
'IGN-F/Géoportail/MNHN'
)
rasterSource([ignServiceURL(code)], 'IGN-F/Géoportail/MNHN')
])
);
}
@ -215,7 +208,7 @@ export default {
url: 'https://openmaptiles.geo.data.gouv.fr/data/france-vector.json'
},
'photographies-aeriennes': rasterSource(
[ignServiceURL('ORTHOIMAGERY.ORTHOPHOTOS', 'decouverte', 'image/jpeg')],
[ignServiceURL('ORTHOIMAGERY.ORTHOPHOTOS', 'image/jpeg')],
'IGN-F/Géoportail'
),
cadastre: {
@ -223,7 +216,7 @@ export default {
url: 'https://openmaptiles.geo.data.gouv.fr/data/cadastre.json'
},
'plan-ign': rasterSource(
[ignServiceURL('GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2', 'decouverte')],
[ignServiceURL('GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2')],
'IGN-F/Géoportail'
),
...buildSources()

View file

@ -20,7 +20,7 @@ Rails.application.config.content_security_policy do |policy|
# It's too complicated to be fixed right now (and it wouldn't add value: this is hardcoded in views, so not subject to injections)
policy.style_src(:self, :unsafe_inline, "*.crisp.chat", "crisp.chat", 'cdn.jsdelivr.net', 'maxcdn.bootstrapcdn.com', "unpkg.com")
connect_whitelist = ["wss://*.crisp.chat", "*.crisp.chat", "app.franceconnect.gouv.fr", "openmaptiles.geo.data.gouv.fr", "openmaptiles.github.io", "tiles.geo.api.gouv.fr", "wxs.ign.fr"]
connect_whitelist = ["wss://*.crisp.chat", "*.crisp.chat", "app.franceconnect.gouv.fr", "openmaptiles.geo.data.gouv.fr", "openmaptiles.github.io", "tiles.geo.api.gouv.fr", "data.geopf.fr"]
connect_whitelist << ENV.fetch('APP_HOST')
connect_whitelist << "*.amazonaws.com" if Rails.configuration.active_storage.service == :amazon
connect_whitelist += [URI(ENV["SENTRY_DSN_JS"]).host, URI(ENV["SENTRY_DSN_RAILS"]).host].compact.uniq