there是最小的代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.45.0/mapbox-gl.css' rel='stylesheet' />
<title>MINIMAL TEST</title>
</head>
<body>
<section id='map' style="width:500px;height:500px;"></section>
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.45.0/mapbox-gl.js'></script>
<script>
mapboxgl.accessToken = 'pk.eyJ1IjoiY2xlbWFwYm94IiwiYSI6ImNqOHVsbjdpdDBxM2wyd3JwcnVjZGtsZmsifQ.cv3w8BmCJAy0f0YF1ZFSTA';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/clemapbox/cjml1byyjq6jt2rni6wbjn3lt',
});
</script>
</body>
</html>
这里的问题似乎与您的样式和您正在使用的GL JS版本不相容。具体而言,因为您的样式使用了
text-radial-offset
风格的属性,该属性不受GL J的支持,直到 +v0.54.0.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.54.0/mapbox-gl.css' rel='stylesheet' />
<title>MINIMAL TEST</title>
</head>
<body>
<section id='map' style="width:500px;height:500px;"></section>
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.54.0/mapbox-gl.js'></script>
<script>
mapboxgl.accessToken = 'pk.eyJ1IjoiY2xlbWFwYm94IiwiYSI6ImNqOHVsbjdpdDBxM2wyd3JwcnVjZGtsZmsifQ.cv3w8BmCJAy0f0YF1ZFSTA';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/clemapbox/cjml1byyjq6jt2rni6wbjn3lt',
});
</script>
</body>
</html>
任何简便的方法来检查客户端库与您的样式兼容的哪种方法是通过工作室中的设置下降:
⚠️免责声明:我目前在Mapbox工作⚠️