-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add basemaps JS usage examples with OpenStreetMap and Overture Maps datasets
- Loading branch information
Showing
5 changed files
with
180 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<html> | ||
<head> | ||
<title>Protomaps Basemaps Example</title> | ||
<meta charset="utf-8"/> | ||
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/maplibre-gl.css" crossorigin="anonymous"> | ||
<script src="https://unpkg.com/[email protected]/dist/maplibre-gl.js" crossorigin="anonymous"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/pmtiles.js"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/protomaps-themes-base.js"></script> | ||
<style> | ||
body { | ||
margin: 0; | ||
} | ||
#map { | ||
height:100%; width:100%; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="map"></div> | ||
<script type="text/javascript"> | ||
let protocol = new pmtiles.Protocol(); | ||
maplibregl.addProtocol("pmtiles", protocol.tile); | ||
|
||
const map = new maplibregl.Map({ | ||
container: "map", | ||
zoom: 13, | ||
center: [-0.12,51.5], | ||
style: { | ||
version: 8, | ||
glyphs: "https://protomaps.github.io/basemaps-assets/fonts/{fontstack}/{range}.pbf", | ||
sprite: `https://protomaps.github.io/basemaps-assets/sprites/v4/light`, | ||
sources: { | ||
example_source: { | ||
type: "vector", | ||
url: "pmtiles://https://demo-bucket.protomaps.com/v4.pmtiles", | ||
attribution: "<a href='https://openstreetmap.org/copyright'>© OpenStreetMap Contributors</a>" | ||
}, | ||
}, | ||
layers: protomaps_themes_base.default("example_source", "light", "en") | ||
}, | ||
}); | ||
|
||
let marker = new maplibregl.Marker() | ||
.setLngLat([-0.12,51.5]) | ||
.setPopup(new maplibregl.Popup().setHTML("<h1>Hello World!</h1>")) | ||
.addTo(map); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<html> | ||
<head> | ||
<title>Protomaps Basemaps Example</title> | ||
<meta charset="utf-8"/> | ||
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/maplibre-gl.css" crossorigin="anonymous"> | ||
<script src="https://unpkg.com/[email protected]/dist/maplibre-gl.js" crossorigin="anonymous"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/pmtiles.js"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/protomaps-themes-base.js"></script> | ||
<style> | ||
body { | ||
margin: 0; | ||
} | ||
#map { | ||
height:100%; width:100%; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="map"></div> | ||
<script type="text/javascript"> | ||
let protocol = new pmtiles.Protocol(); | ||
maplibregl.addProtocol("pmtiles", protocol.tile); | ||
|
||
const map = new maplibregl.Map({ | ||
container: "map", | ||
zoom: 13, | ||
center: [-0.12,51.5], | ||
style: { | ||
version: 8, | ||
glyphs: "https://protomaps.github.io/basemaps-assets/fonts/{fontstack}/{range}.pbf", | ||
sprite: `https://protomaps.github.io/basemaps-assets/sprites/v4/light`, | ||
sources: { | ||
example_source: { | ||
type: "vector", | ||
url: "pmtiles://https://demo-bucket.protomaps.com/v4.pmtiles", | ||
attribution: "<a href='https://openstreetmap.org/copyright'>© OpenStreetMap Contributors</a>" | ||
}, | ||
overture_places: { | ||
type: "vector", | ||
url: "pmtiles://https://overturemaps-tiles-us-west-2-beta.s3.amazonaws.com/2024-12-18/places.pmtiles", | ||
attribution: "<a href='https://overturemaps.org'>Overture Maps Foundation</a>" | ||
} | ||
}, | ||
layers: [ | ||
...protomaps_themes_base.noLabels("example_source", "grayscale"), | ||
{ | ||
"id": "overture_places", | ||
"source": "overture_places", | ||
"source-layer": "place", | ||
"type": "circle", | ||
"paint": { | ||
"circle-color": "#2525A4", | ||
"circle-opacity": 0.2, | ||
"circle-radius": [ | ||
"step", | ||
["zoom"], | ||
1, | ||
13, 2, | ||
14, 3, | ||
15, 6, | ||
16, 8 | ||
] | ||
} | ||
}, | ||
...protomaps_themes_base.labels("example_source", "grayscale", "en") | ||
] | ||
}, | ||
}); | ||
|
||
let marker = new maplibregl.Marker() | ||
.setLngLat([-0.12,51.5]) | ||
.setPopup(new maplibregl.Popup().setHTML("<h1>Hello World!</h1>")) | ||
.addTo(map); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<html> | ||
<head> | ||
<title>Protomaps Basemaps Example</title> | ||
<meta charset="utf-8"/> | ||
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/maplibre-gl.css" crossorigin="anonymous"> | ||
<script src="https://unpkg.com/[email protected]/dist/maplibre-gl.js" crossorigin="anonymous"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/pmtiles.js"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/protomaps-themes-base.js"></script> | ||
<style> | ||
body { | ||
margin: 0; | ||
} | ||
#map { | ||
height:100%; width:100%; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="map"></div> | ||
<script type="text/javascript"> | ||
let protocol = new pmtiles.Protocol(); | ||
maplibregl.addProtocol("pmtiles", protocol.tile); | ||
|
||
const map = new maplibregl.Map({ | ||
container: "map", | ||
zoom: 13, | ||
center: [-0.12,51.5], | ||
style: { | ||
version: 8, | ||
glyphs: "https://protomaps.github.io/basemaps-assets/fonts/{fontstack}/{range}.pbf", | ||
sprite: `https://protomaps.github.io/basemaps-assets/sprites/v4/light`, | ||
sources: { | ||
example_source: { | ||
type: "vector", | ||
url: "pmtiles://https://demo-bucket.protomaps.com/v4.pmtiles", | ||
attribution: "<a href='https://openstreetmap.org/copyright'>© OpenStreetMap Contributors</a>" | ||
}, | ||
}, | ||
layers: protomaps_themes_base.default("example_source", "black", "zh-Hant") | ||
}, | ||
}); | ||
</script> | ||
</body> | ||
</html> |