Mapbox tiles and Leafletjs

喜夏-厌秋 提交于 2019-12-02 16:21:39

I actually finally found the answer.

The URL string needed to be updated to

https://api.mapbox.com/styles/v1/mapbox/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}

The available styles ({id}) are

  • streets-v9
  • satellite-streets-v9
  • light-v9
  • dark-v9
  • outdoors-v9

Full list of Mapbox classic map IDs, ie for Leaflet, are at https://www.mapbox.com/api-documentation/#maps.

At the time of writing the IDs are:

  • mapbox.streets
  • mapbox.light
  • mapbox.dark
  • mapbox.satellite
  • mapbox.streets-satellite
  • mapbox.wheatpaste
  • mapbox.streets-basic
  • mapbox.comic
  • mapbox.outdoors
  • mapbox.run-bike-hike
  • mapbox.pencil
  • mapbox.pirates
  • mapbox.emerald
  • mapbox.high-contrast

Actually, the new tile layers 'styles' that Mapbox was referring to were vector tile layers.

Mapbox-GL JS uses vector styles which you listed (xxx-v9). (up to date as of 05/2019)

Mapbox JS is built on top of Leaflet (L.tilelayer()) and uses raster tilesets, which are images. Here are the available basemaps from Mapbox.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!