-
I have the following example working with Could some more style information be necessary with maplibre-gl 4? <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Display a map on a webpage</title>
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=" />
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/maplibre-gl.css" />
<script src="https://unpkg.com/[email protected]/dist/maplibre-gl.js"></script>
<script src="https://unpkg.com/[email protected]/dist/index.js"></script>
<style>
body {
margin: 0;
padding: 0;
}
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
window.map = new maplibregl.Map({
container: "map",
hash: true,
center: [-122.4194, 37.7749],
zoom: 12,
style: {
version: 8,
glyphs: "https://protomaps.github.io/basemaps-assets/fonts/{fontstack}/{range}.pbf",
sources: {
protomaps: {
type: "vector",
url: "https://api.protomaps.com/tiles/v3.json?key=YOUR_KEY_HERE",
},
},
layers: protomaps_themes_base.default("protomaps", "light"),
},
});
</script>
</body>
</html> |
Beta Was this translation helpful? Give feedback.
Answered by
lrowe
Feb 16, 2024
Replies: 1 comment 7 replies
-
The example as pasted (with a valid api key in YOUR_KEY_HERE) works on 4.0.0 for me. What browser are you using? |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, I reported in maplibre/maplibre-gl-js#3680 and it got fixed in maplibre/maplibre-gl-js#3681 which is included in the 4.0.1 release.
Updating my example to use mapbox-gl 4.0.1 works as a file url in both Chrome and Safari.