กำลังโหลดตัวอย่างแผนที่...
ตัวอย่างเริ่มต้นการเชื่อมต่อ OGS Map Viewer (maptile.onegeo.co.th) พร้อมเครื่องมือควบคุมแผนที่สำหรับ MapLibre GL JS และ Leaflet
<!doctype html>
<html lang="th">
<head>
<meta charset="utf-8" />
<title>OGS Map Viewer - MapLibre Mode</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
href="https://unpkg.com/maplibre-gl@5.15.0/dist/maplibre-gl.css"
rel="stylesheet"
/>
<script src="https://unpkg.com/maplibre-gl@5.15.0/dist/maplibre-gl.js"></script>
<style>
body,
html {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
overflow: hidden;
}
#map {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
const key = "your Api Key";
const map = new maplibregl.Map({
container: "map",
style: {
version: 8,
sources: {
ogs: {
type: "raster",
tiles: [
`https://maptile.onegeo.co.th/tile/{z}/{x}/{y}.png?ApiKey=${key}`,
],
tileSize: 256,
},
},
layers: [
{
id: "ogs-layer",
type: "raster",
source: "ogs",
},
],
},
center: [100.5018, 13.7563],
zoom: 6,
});
map.addControl(new maplibregl.NavigationControl());
</script>
</body>
</html>