Mapbox磁贴和Leaflet.js [英] Mapbox tiles and Leafletjs
本文介绍了Mapbox磁贴和Leaflet.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在地图上加载一些其他平铺图层,但我不太清楚.我目前拥有的那些,我只感谢提供了教程但没有说明其他磁贴选项是什么的人.有人可以帮我吗?
I'm trying to load some additional tile layers on my map but I can't quite figure it out. The ones that I currently have I only have thanks to someone that provided a tutorial but didn't say what the other tile options were. Can someone help me with this?
var mapboxUrl = 'https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}';
var accessToken = 'mySuperSecretToken';
var grayscale = L.tileLayer(mapboxUrl, {id: 'mapbox.light', attribution: '', maxZoom: 20, accessToken: accessToken}),
streets = L.tileLayer(mapboxUrl, {id: 'mapbox.streets', attribution: '', maxZoom: 20, accessToken: accessToken});
我似乎无法弄清楚如何获得更多图层,甚至无法使用我今天收到的有关电子邮件的新街道版本.
I cannot seem to figure out how to get any additional layers or even use the new streets version that I got an email about today.
推荐答案
我实际上终于找到了答案.
I actually finally found the answer.
URL字符串需要更新为
The URL string needed to be updated to
https://api.mapbox.com/styles/v1/mapbox/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}
可用样式({id})是
The available styles ({id}) are
- streets-v9
- satellite-streets-v9
- light-v9
- dark-v9
- outdoors-v9
这篇关于Mapbox磁贴和Leaflet.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文