无法为我的 Mapbox 样式地图找到 Mapbox Vector Tile URL

Cannot find Mapbox Vector Tile URL for my Mapbox Style map

有谁知道如何获取 Mapbox 矢量切片地图(也称为“样式”)的 URL?我只能得到一个看起来像这样的样式地址:mapbox://styles/myusername/r3411y10ngh4sh3tc3tc,但我使用的插件需要 URL 来将 Mapbox 的 Vector Tiles 与 Leaflet 集成:https://github.com/SpatialServer/Leaflet.MapboxVectorTile/blob/master/docs/configuration.md

我尝试用 Mapbox 提供的样式地址替换 URL

var config = {
  url: "mapbox://styles/myusername/fwaoij32wlfij23slkfj3",
  ...etc
};

var mvtSource = new L.TileLayer.MVTSource(config);
map.addLayer(mvtSource);

但我收到一个错误,无法将样式地址读取为 URL。有什么建议么?我应该使用不同的插件吗?


更新

简而言之,Mapbox 样式的 URL 尚不可用。这是我从 Mapbox 收到的回复:

Leaflet is not yet compatible with styles made in Mapbox Studio since these styles require a GL-based renderer. We're currently working on a new API to allow you to use your Studio style with Leaflet, we expect it to launch in a few weeks.

At this time, you can use Mapbox GL JS to load your Mapbox Studio style. You can still access raster map IDs (maps made with Mapbox Editor, Mapbox Studio Classic) to load with Leaflet - these are found under the "Classic" tab in the Studio dashboard.

Leaflet.MapboxVectorTile 插件使用与 Mapbox GL JS 库等不同的样式方法。

您在 Mapbox Studio 中创建的样式可以下载为 JSON,但对于 Leaflet.MapboxVectorTile,您必须以编程方式创建它们,如您在 the documentation 中所见。您仍然可以使用他们的矢量拼贴 URL https://b.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/{z}/{x}/{y}.vector.pbf?access_token=<public api token>,但样式可能必须再次从头开始 rewritten/done。

您可以使用Mapbox Gl Javascript来创建具有您创建的样式的地图,但我不知道您当前的项目有多广泛以及它是否会与其他(Leaflet)插件冲突:

mapboxgl.accessToken = '<public API token>';
var map = new mapboxgl.Map({
    container: 'map',
    style: 'mapbox://styles/<your name>/<style id>',
    center: [-74.50, 40],
    zoom: 9
});