gpt4 book ai didi

javascript - 是否可以将传单版本 1 与自定义 mapbox 样式一起使用?

转载 作者:行者123 更新时间:2023-11-30 12:04:37 25 4
gpt4 key购买 nike

这会产生一个错误

leaflet.js:5 Uncaught TypeError: Cannot read property 'call' of undefined

    <!-- Leaflet -->
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.js"></script>
<!-- Mapbox GL -->
<link href="https://api.tiles.mapbox.com/mapbox-gl-js/v0.12.3/mapbox-gl.css" rel='stylesheet' />
<script src="https://api.tiles.mapbox.com/mapbox-gl-js/v0.12.3/mapbox-gl.js"></script>


mapboxgl.accessToken = YOUR_KEY;
var map = new mapboxgl.Map({
container: 'map',
style: YOUR_STYLE_URL
center: [0, 0],
zoom: 0
});

最佳答案

据我所知这是不可能的,但是 Mapbox.js(基于 Leaflet)从 2.3.0 版开始通过 L.mapbox.styleLayer 支持样式 url:

L.mapbox.accessToken = YOUR_ACCESS_TOKEN;

var map = L.mapbox.map('map').setView([38.97416, -95.23252], 15);

// Use styleLayer to add a Mapbox style created in Mapbox Studio
L.mapbox.styleLayer('mapbox://styles/mapbox/emerald-v8').addTo(map);

参见:https://www.mapbox.com/mapbox.js/example/v1.0.0/stylelayer/

关于javascript - 是否可以将传单版本 1 与自定义 mapbox 样式一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35590579/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com