Skip to content

Instantly share code, notes, and snippets.

@gwaldron
Created October 24, 2025 13:06
Show Gist options
  • Save gwaldron/2f413062a7c5dd795f1338900586213c to your computer and use it in GitHub Desktop.
Save gwaldron/2f413062a7c5dd795f1338900586213c to your computer and use it in GitHub Desktop.
MapLibre-GL simple app
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MapLibre GL - XYZ Raster Tiles Demo</title>
<!-- MapLibre GL JS -->
<script src="https://unpkg.com/[email protected]/dist/maplibre-gl.js"></script>
<link href="https://unpkg.com/[email protected]/dist/maplibre-gl.css" rel="stylesheet" />
<style>
body {
margin: 0;
padding: 0;
}
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
// Initialize the map
var map = new maplibregl.Map({
container: 'map', // container id
style: 'https://demotiles.maplibre.org/globe.json', // style URL
center: [0, 0], // starting position [lng, lat]
zoom: 2, // starting zoom
projection: 'globe'
});
// Add navigation controls
map.addControl(new maplibregl.NavigationControl());
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment