index.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Display a map</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src="https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js"></script>
<link rel="stylesheet" type="text/css" href="https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css">
<style type="text/css">
body { margin: 0; padding: 0; }
#map { position: absolute; top: 0; bottom: 0; width: 100%; }
</style>
</head>
<body>
<div id="map"></div>
<script type="text/javascript">
const url_style = "https://data.geopf.fr/annexes/ressources/vectorTiles/styles/PLAN.IGN/standard.json";
fetch(url_style).then(res => res.json()).then(style => {
style.sources.plan_ign.scheme = 'xyz';
style.sources.plan_ign.attribution = 'Données cartographiques : © IGN';
const map = new maplibregl.Map({
container: 'map',
style: style,
center: [3.389162, 46.852644],
zoom: 5,
attributionControl: false
});
map.addControl(new maplibregl.AttributionControl({compact: true}));
})
</script>
</body>
</html>
index-isohypse.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Display a map</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src="https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js"></script>
<link rel="stylesheet" type="text/css" href="https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css">
<style type="text/css">
body { margin: 0; padding: 0; }
#map { position: absolute; top: 0; bottom: 0; width: 100%; }
</style>
</head>
<body>
<div id="map"></div>
<script type="text/javascript">
window.debugStyleMaplibre = null;
const url_style = "https://data.geopf.fr/annexes/ressources/vectorTiles/styles/ISOHYPSE/isohypse_monochrome_orange.json"
fetch(url_style).then(res => res.json()).then(style => {
window.debugStyleMaplibre = style;
style.sources.isohypse.attribution = 'Données cartographiques : © IGN';
style.layers = style.layers.filter(el => el['source-layer'] != 'frontiere_france')
const map = new maplibregl.Map({
container: 'map',
style: style,
center: [6.018308, 45.390043],
zoom: 15,
attributionControl: false,
hash: true
});
map.addControl(new maplibregl.AttributionControl({compact: false}));
})
</script>
</body>
</html>