Migrate tests to use maplibre-gl (#449)

Migrates the HTML test files to use `maplibre-gl` instead of `mapbox-gl`. I kept the same version as in `tests/debug-maplibre.html` and used the Carto Positron style on `tests/debug.html` because it was the closet to Mapbox's light style.
This commit is contained in:
Pat Sier 2022-10-16 13:56:29 -05:00 committed by GitHub
parent 81c14a69c3
commit f5e19ddf9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 31 deletions

View File

@ -4,8 +4,8 @@
<meta charset="utf-8" />
<title>Martin Debug Page</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<script src="https://api.tiles.mapbox.com/mapbox-gl-js/v0.52.0/mapbox-gl.js"></script>
<link href="https://api.tiles.mapbox.com/mapbox-gl-js/v0.52.0/mapbox-gl.css" rel="stylesheet" />
<script src="https://unpkg.com/maplibre-gl@2.1.9/dist/maplibre-gl.js"></script>
<link href="https://unpkg.com/maplibre-gl@2.1.9/dist/maplibre-gl.css" rel="stylesheet" />
<style>
body {
@ -26,18 +26,9 @@
<div id="map"></div>
<script>
let accessToken = localStorage.getItem('accessToken');
if (!accessToken) {
accessToken = window.prompt('Mapbox accessToken');
localStorage.setItem('accessToken', accessToken);
}
mapboxgl.accessToken = accessToken;
const map = new mapboxgl.Map({
const map = new maplibregl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/light-v9',
style: 'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json',
zoom: 0,
center: [0, 0]
});

View File

@ -8,8 +8,8 @@
content="initial-scale=1,maximum-scale=1,user-scalable=no"
/>
<script src="https://unpkg.com/deck.gl@^8.4.0/dist.min.js"></script>
<script src="https://libs.cartocdn.com/mapbox-gl/v1.13.0/mapbox-gl.js"></script>
<link href="https://libs.cartocdn.com/mapbox-gl/v1.13.0/mapbox-gl.css" rel="stylesheet" />
<script src="https://unpkg.com/maplibre-gl@2.1.9/dist/maplibre-gl.js"></script>
<link href="https://unpkg.com/maplibre-gl@2.1.9/dist/maplibre-gl.css" rel="stylesheet" />
<style>
body {
@ -30,6 +30,7 @@
<script>
const deckgl = new deck.DeckGL({
container: 'map',
map: maplibregl,
mapStyle: 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json',
initialViewState: {
latitude: 0,

View File

@ -7,11 +7,8 @@
name="viewport"
content="initial-scale=1,maximum-scale=1,user-scalable=no"
/>
<script src="https://api.tiles.mapbox.com/mapbox-gl-js/v0.52.0/mapbox-gl.js"></script>
<link
href="https://api.tiles.mapbox.com/mapbox-gl-js/v0.52.0/mapbox-gl.css"
rel="stylesheet"
/>
<script src="https://unpkg.com/maplibre-gl@2.1.9/dist/maplibre-gl.js"></script>
<link href="https://unpkg.com/maplibre-gl@2.1.9/dist/maplibre-gl.css" rel="stylesheet" />
<style>
body {
@ -79,18 +76,9 @@
<div id="map"></div>
<script>
let accessToken = localStorage.getItem('accessToken');
if (!accessToken) {
accessToken = window.prompt('Mapbox accessToken');
localStorage.setItem('accessToken', accessToken);
}
mapboxgl.accessToken = accessToken;
const map = new mapboxgl.Map({
const map = new maplibregl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/light-v9',
style: 'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json',
zoom: 0,
center: [0, 0],
hash: true