Skip to content

Commit 08fdb62

Browse files
committed
feat(data): add datatourisme fetes et manifestations
1 parent 27b80dc commit 08fdb62

File tree

6 files changed

+116
-5
lines changed

6 files changed

+116
-5
lines changed

config/gfi-rules.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
11
{
2+
"DATATOURISME.FMA$PMTILES": {
3+
"0": {
4+
"title": "@title",
5+
"title2": "@dateRange",
6+
"title2type": "date",
7+
"subtitle": "<a href=\"https://www.datatourisme.fr/\" target=\"_blank\" style=\"color: var(--darker-green);\">Datatourisme</a> (Fêtes et manifestations) - Source&nbsp;: Datatourisme, ADN Tourisme",
8+
"bodyAfter": [
9+
["<div class=\"unescoDate\"><p><img class=\"unescoimg\" alt=\"{{title}}\" src=\"{{image_url}}\" width=\"150px\">"],
10+
["<span class=\"monumentsHistoriquesImageAuthor\">Crédit de l'image&nbsp;: {{imageCredits}}</span></p></div>"],
11+
["<span class=\"monumentsHistoriquesImageAuthor\">Évènement créé par &nbsp;: {{creator}}</span></p></div>"],
12+
["<input type=\"checkbox\" class=\"d-none foldableInput\" id=\"foldableInputJEP\">"],
13+
["<div class=\"monumentsHistoriquesContent foldable\">{{{description}}}</div>"],
14+
["<label class=\"foldableLabel\" for=\"foldableInputJEP\">&nbsp;Voir&nbsp;</label>"],
15+
["<hr />"],
16+
["<p class=\"monumentsHistoriquesContent\"><b>Accès principal&nbsp;:</b><br /> {{address}}</p>"],
17+
["<p class=\"monumentsHistoriquesContent\"><b>Horaires d'ouverture&nbsp;:</b><br /> {{fullOpeningHoursString}}</p>"],
18+
["<p class=\"monumentsHistoriquesContent\">{{reducedMobilityAccess}}</p>"],
19+
["<p class=\"monumentsHistoriquesContent\"><b>Site web du lieu&nbsp;:</b><br /> {{internetAccess}}</p>"],
20+
["<hr />"],
21+
["<p class=\"positionWeb positionInfo\"><a target=\"_blank\" href=\"{{registrationWeb}}\">Réserver en ligne</a></p>"],
22+
["<p class=\"positionTelephone positionInfo\"><a target=\"_blank\" href=\"tel:{{registrationPhone}}\">Réserver par téléphone</a></p>"],
23+
["<p class=\"positionEmail positionInfo\"><a target=\"_blank\" href=\"mailto:{{registrationEmail}}\">Réserver par courriel</a></p>"]
24+
]
25+
}
26+
},
227
"TRACES.RANDO.HIVERNALE$WMTS": {
328
"0": {
429
"title": "@nom_de_la_trace",

config/layers-config.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,16 @@
325325
"format": "image/png"
326326
},
327327

328+
"DATATOURISME.FMA$PMTILES": {
329+
"hidden": true,
330+
"serverUrl": "pmtiles://https://data.geopf.fr/chunk/telechargement/download/DATATOURISME.FMA/archive/data.pmtiles",
331+
"title": "Datatourisme - Fêtes et manifestations",
332+
"description": "Datatourisme - Fêtes et manifestations : Localisation des événements touristiques en France métropolitaine et dans les départements et régions d’Outre-Mer (DROM). Les données sont issues de la plateforme Datatourisme, qui agrège les données de nombreux acteurs du tourisme en France. Les données sont mises à jour régulièrement par les producteurs de données.",
333+
"source": "Datatourisme, ADN Tourisme",
334+
"format": "application/vnd.pmtiles",
335+
"styles": ["https://ignf.github.io/cartes-ign-app/datatourisme.json", "data/datatourisme.json"]
336+
},
337+
328338
"PLAN.IGN.INTERACTIF$TMS": {
329339
"hidden": true,
330340
"serverUrl": "https://data.geopf.fr/tms/1.0.0/",

config/thematics-layer-config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
{
6464
"name": "Tourisme et loisirs",
6565
"layers": [
66+
"DATATOURISME.FMA$PMTILES",
6667
"IGNF_SITES-UNESCO$WMS",
6768
"POI.MONUMENTS_BDD_WLD_WM$WMS",
6869
"CJP-PARCS-JARDINS_BDD-POI_WLD_WM$WMS",

src/js/layer-manager/layer-config.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ import { config } from "../utils/config-utils";
2525
*/
2626
const getLayerProps = (id) => {
2727
var props = config.configLayers.layers[id];
28-
var isVector = id.split("$")[1] === "TMS" ? true : false;
28+
var isVector = false;
29+
if (id.split("$")[1] === "TMS" || id.split("$")[1] === "PMTILES") {
30+
isVector = true;
31+
}
2932
var style;
3033
if (isVector) {
3134
style = props.styles[0];
@@ -185,6 +188,9 @@ const createSource = (id) => {
185188
// dans le fichier de style.
186189
fxt = createVectorSource;
187190
break;
191+
case "PMTILES":
192+
fxt = createVectorPMTilesSource;
193+
break;
188194
default:
189195
throw new Error(`LayerConfig : ID layer service (${name}) is not conforme : ${service}`);
190196
}
@@ -260,6 +266,18 @@ const createVectorSource = (id) => {
260266
};
261267
};
262268

269+
/**
270+
* Creer les propriétés d'une couche de type Vector au format PMTiles pour la librairie MapLibre
271+
* @param {*} id
272+
*/
273+
const createVectorPMTilesSource = (id) => {
274+
var props = getLayerProps(id);
275+
return {
276+
type: "vector",
277+
url: props.url,
278+
};
279+
};
280+
263281
/**
264282
* Creer les propriétés d'une couche de type Vector pour la librairie MapLibre
265283
* @param {*} layer

src/js/map-interactivity/map-interactivity.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,16 @@ class MapInteractivity {
181181

182182
if (features.length > 0) {
183183
const tempLayers = LayersConfig.getTempLayers();
184-
if ( tempLayers.map(layer => layer.id).includes(features[0].source) ) {
185-
const layerConfig = tempLayers.filter(layer => layer.id === features[0].source)[0];
186-
const resp = gfiRules.parseGFI(layerConfig.gfiRules, {features: features}, this.map.getZoom());
184+
const isPMTiles = features[0].layer.id.includes("$PMTILES");
185+
if ( isPMTiles || tempLayers.map(layer => layer.id).includes(features[0].source) ) {
186+
let rules;
187+
if (isPMTiles) {
188+
rules = gfiRules[features[0].layer.id.split("$$$")[1]];
189+
} else {
190+
const layerConfig = tempLayers.filter(layer => layer.id === features[0].source)[0];
191+
rules = layerConfig.gfiRules;
192+
}
193+
const resp = gfiRules.parseGFI(rules, {features: features}, this.map.getZoom());
187194
let lngLat = ev.lngLat;
188195
if (features[0].geometry.type === "Point") {
189196
lngLat = {
@@ -196,7 +203,7 @@ class MapInteractivity {
196203
text: resp.title,
197204
html: resp.html,
198205
html2: resp.html2,
199-
isEvent: true,
206+
isEvent: !isPMTiles,
200207
}).then(() => {
201208
Globals.menu.open("position");
202209
this.map.once("click", this.handleInfoOnMap);

www/data/datatourisme.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"version": 8,
3+
"name": "Datatourisme - Fêtes et manifestations",
4+
"glyphs": "https://data.geopf.fr/annexes/ressources/vectorTiles/fonts/{fontstack}/{range}.pbf",
5+
"sprite": "data/poi-osm-sprite",
6+
"sources": {
7+
"datatourisme": {
8+
"type": "vector",
9+
"url": "pmtiles://https://data.geopf.fr/chunk/telechargement/download/DATATOURISME.FMA/archive/data.pmtiles"
10+
}
11+
},
12+
"transition": {
13+
"duration": 300,
14+
"delay": 0
15+
},
16+
"layers": [
17+
{
18+
"id": "datatourisme",
19+
"type": "symbol",
20+
"source": "datatourisme",
21+
"source-layer": "datatourisme",
22+
"layout": {
23+
"icon-image": "Phare",
24+
"icon-allow-overlap": ["step", ["zoom"], false, 14, true],
25+
"icon-size": [
26+
"interpolate",
27+
["exponential", 1.5],
28+
["zoom"],
29+
0,
30+
["case",
31+
["boolean", ["get", "highlight"], false], 2,
32+
1.5],
33+
9,
34+
["case",
35+
["boolean", ["get", "highlight"], false], 2,
36+
1.5],
37+
15,
38+
["case",
39+
["boolean", ["get", "highlight"], false], 3.5,
40+
2.5],
41+
19,
42+
["case",
43+
["boolean", ["get", "highlight"], false], 4.5,
44+
3]
45+
],
46+
"icon-anchor": "bottom"
47+
}
48+
}
49+
]
50+
}

0 commit comments

Comments
 (0)