mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 10:51:07 +00:00
rename maplibre_headers to maplibre_advanced; show metadata description (#506)
This commit is contained in:
@@ -10,12 +10,14 @@
|
||||
margin: 0;
|
||||
}
|
||||
#map {
|
||||
height:100%; width:100%;
|
||||
height:calc(100% - 50px);
|
||||
width:100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map"></div>
|
||||
Description from PMTiles metadata: <span id="description"></span>
|
||||
<script type="text/javascript">
|
||||
// Advanced MapLibre example demonstrating PMTiles JavaScript API + pmtiles:// protocol.
|
||||
|
||||
@@ -31,6 +33,10 @@
|
||||
// this is so we share one instance across the JS code and the map renderer
|
||||
protocol.add(p);
|
||||
|
||||
p.getMetadata().then((m) => {
|
||||
document.getElementById("description").textContent = m.description;
|
||||
})
|
||||
|
||||
// we first fetch the header so we can get the center lon, lat of the map.
|
||||
p.getHeader().then((h) => {
|
||||
const map = new maplibregl.Map({
|
||||
Reference in New Issue
Block a user