This commit is contained in:
2024-05-03 23:25:24 +04:00
parent a20ed4cbc7
commit 826cc430a4
6 changed files with 102 additions and 2 deletions
+1
View File
@@ -8,6 +8,7 @@
<body>
<h1>Choisis une carte</h1>
<ul>
<li><a href="kat/KAMA.php">Afrique</a></li>
<li><a href="kat/971.php">Guadeloupe (971)</a></li>
<li><a href="kat/972.php">Martinique (972)</a></li>
<li><a href="kat/973.php">Guyane (973)</a></li>
+17 -2
View File
@@ -16,6 +16,11 @@ let zoomLevel
let styleFileName
switch (codeDepartement) {
case 'KAMA':
centerCoordinates = [21.21, 1.36] // Afrique
zoomLevel = 2.7
styleFileName = 'ortho-jwe-KAMA.json'
break
case '971':
centerCoordinates = [-61.4167, 16.25] // Guadeloupe
zoomLevel = 9
@@ -68,6 +73,16 @@ if (codeDepartement !== '973') {
map.setMaxZoom(9.5)
}
if (codeDepartement === 'KAMA') {
/**
* Ajoute les contrôles de navigation à la carte, et définit les niveaux de zoom minimum et maximum pour la Guyane.
*/
map.addControl(new maplibregl.NavigationControl({showCompass: false}))
map.setMinZoom(2.4)
map.setMaxZoom(9)
map.dragPan.enable()
}
/**
* Définit les décalages des popups en fonction de leur position.
*/
@@ -112,7 +127,7 @@ const correctAnswers = new Set()
*/
async function getFile(codeDepartement) {
try {
const response = await fetch(`../kat/data/${codeDepartement}/contours-communes.geojson`)
const response = await fetch(`../kat/data/${codeDepartement}/contours-${codeDepartement === 'KAMA' ? 'pays' : 'communes'}.geojson`)
if (!response.ok) {
throw new Error(`Échec du chargement du fichier JSON : ${response.statusText}`)
}
@@ -229,7 +244,7 @@ map.on('load', async () => {
*/
map.addSource('communes', {
'type': 'geojson',
'data': `../kat/data/${codeDepartement}/contours-communes.geojson`,
'data': `../kat/data/${codeDepartement}/contours-${codeDepartement === 'KAMA' ? 'pays' : 'communes'}.geojson`,
'promoteId': 'code'
})
+26
View File
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>JWE - KAT</title>
<link rel="stylesheet" href="https://unpkg.com/maplibre-gl/dist/maplibre-gl.css" />
<link rel="stylesheet" href="../css/map.css" />
</head>
<body>
<h1 id="title">Afrique</h1>
<div style="display: flex; justify-content: center;">
<p style="color: green; font-weight: bold; margin-right: 2em;">Correct : <span style="color: black;" id="OK">0</span></p>
<p style="color: red; font-weight: bold;">Faux : <span style="color: black;" id="KO">0</span></p>
</div>
<div>
<p style="font-weight: bold;">Trouve le pays</p>
<p id="commune" style="font-size: 30px; font-weight: bold; color: #1F51FF">...</p>
</div>
<div id="map"></div>
<script src="https://unpkg.com/maplibre-gl/dist/maplibre-gl.js"></script>
<script src="../js/map.js"></script>
</body>
</html>
+1
View File
@@ -0,0 +1 @@
{"ETH":[38.947611801806495,9.176814264950167],"SDS":[30.333984675480757,7.914722205528841],"SOM":[46.5464912522007,6.019175354863551],"KEN":[37.67592532581279,0.5754517148962938],"MWI":[34.09609576769113,-12.735921358471073],"TZA":[35.02498976184473,-6.566525957661288],"SOL":[45.53479066506411,10.023473808092941],"MAR":[-9.046877128746582,28.467636665531234],"SAH":[-12.391359135142558,24.416734554893036],"COG":[14.38464128008542,-1.1354128251164652],"COD":[23.704062532123782,-4.540787787186473],"NAM":[18.118996644631416,-21.83831839276176],"ZAF":[25.24975775021357,-28.817139228003967],"LBY":[17.664886093139636,28.172444725036605],"TUN":[9.882258580942635,34.22426090761612],"ZMB":[28.80207441614033,-12.512532465508636],"SLE":[-11.936779785156242,8.548585165700597],"GIN":[-10.715817638913904,10.109710183267284],"LBR":[-9.0900040336277,6.986474255548001],"CAF":[20.072171294504646,6.3873503410410155],"SDN":[30.120938288256728,13.975380990751114],"DJI":[42.62365767045457,11.756886541193175],"ERI":[39.367317191633596,15.18048657614088],"CIV":[-5.781225753157097,7.972692202215326],"MLI":[-5.421274816662242,14.822845678349621],"SEN":[-14.389369189049583,14.030028086260339],"NGA":[7.736925662551809,8.550665249482046],"BEN":[2.3506708850599414,9.720748943172085],"AGO":[17.418358503069197,-10.850000871930797],"BWA":[24.581611328124996,-22.54493652343752],"ZWE":[29.6308403060281,-19.12852949334319],"TCD":[18.96083041487069,12.76727387526939],"DZA":[1.7720829050164644,29.20973285875821],"MOZ":[35.32805940685356,-17.11878541610783],"SWZ":[31.558316617398656,-26.473094383445954],"BDI":[29.989004159902603,-3.062598924512992],"RWA":[29.916395531631114,-2.013365806021347],"UGA":[32.11797202339386,1.3982593728177313],"LSO":[28.192589689555945,-29.671546052631577],"CMR":[13.006806556679795,6.257060071185528],"GAB":[11.616017795138896,-0.8739639395254695],"NER":[6.34184839443898,15.351725132258853],"BFA":[-1.6133907257564375,11.978387935577883],"TGO":[0.7269224654796614,8.681028948643402],"GHA":[-1.0836453419811212,8.284749272184547],"GNB":[-15.375719884923969,11.688141034100504],"EGY":[30.779661923363108,27.661831325954854],"MRT":[-11.604420093309178,19.791261755485873],"GNQ":[9.71551682692309,2.0668689903846107],"GMB":[-15.49098985460068,13.434295654296868],"MDG":[46.962987167300405,-17.773911299904935],"COM":[43.85425415039061,-11.994052124023446],"STP":[6.957070312500013,0.8602416992187436],"CPV":[-23.908437994462016,16.04201691060126]}
File diff suppressed because one or more lines are too long
+56
View File
@@ -0,0 +1,56 @@
{
"version": 8,
"glyphs":"https://wxs.ign.fr/static/vectorTiles/fonts/{fontstack}/{range}.pbf",
"sources": {
"raster-tiles": {
"type": "raster",
"tiles": [
"https://wxs.ign.fr/essentiels/geoportail/wmts?layer=ORTHOIMAGERY.ORTHOPHOTOS&style=normal&tilematrixset=PM&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image%2Fjpeg&TileMatrix={z}&TileCol={x}&TileRow={y}"
],
"tileSize": 256,
"attribution": "<a target='_blank' href='https://geoservices.ign.fr/documentation/donnees/ortho/bdortho'>© IGN</a>"
},
"kama": {
"type": "vector",
"url": "https://tiles.jwe.ovh/data/KAMA.json"
}
},
"layers": [
{
"id": "simple-tiles",
"type": "raster",
"source": "raster-tiles"
},
{
"id": "boundary",
"type": "line",
"source": "kama",
"source-layer": "boundary",
"minzoom": 2,
"layout": {
"line-join": "round",
"visibility": "visible"
},
"paint": {
"line-color": "#ffffff",
"line-width": {
"base": 1.4,
"stops": [
[
4,
2
],
[
5,
1
],
[
12,
3
]
]
}
}
}
]
}