添加自定义地图样式Mapbox.js [英] Add custom map style to Mapbox.js

查看:4058
本文介绍了添加自定义地图样式Mapbox.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚创建与Mapbox工作室我的个人风格的地图,我尝试使用Mapbox.js使用它。 (NOT Mapbox胃肠JS !!)
作为写在实况

I just created my personal map style with Mapbox Studio and i'm try to use it with Mapbox.js. (NOT Mapbox Gl js!!) As written in the docu

您可以加载并使用Mapbox GL JS或Mapbox移动SDK API的显示风格,或者你可以直接从API请求样式。此请求需要的样式访问令牌:读取范围

You can load and display styles from the API using Mapbox GL JS or the Mapbox Mobile SDKs or you can request styles directly from the API. This request requires an access token with the styles:read scope.

我加于我的LT;头>的链接:
https://api.mapbox.com/styles/v1/myusername/mystyleid?access_token=mypublicaccesstoken

I added on my < head > a link to: https://api.mapbox.com/styles/v1/myusername/mystyleid?access_token=mypublicaccesstoken

我可以看到JSON响应,但我仍然看到基本的地图风格。

I can see the JSON response but i still see basic map style.

我如何使用我的自定义风格mapbox.js?

How can i use my custom style in mapbox.js?

推荐答案

抱歉,这是行不通的。 Mapbox样式是与Mapbox GL和原生iOS和Android SDK的使用。你不能用经典Mapbox JS使用它们。 Mapbox JS支持光栅瓷砖,你不能风格的。他们只是图像。 Mapbox GL和原生SDK的(可以)使用矢量瓷砖和那些风格化。如果你想创建用于Mapbox JS你可以这样做使用使用自定义地形设置Mapbox工作室经典。

Sorry, but that won't work. Mapbox Styles are for use with Mapbox GL and the native iOS and Android SDK's. You can't use them with classic Mapbox JS. Mapbox JS supports raster tiles, you can't style those. They're just images. Mapbox GL and the native SDK's (can) use vector tiles and those are stylable. If you want to create a custom tileset for use with Mapbox JS you can do so using Mapbox Studio Classic.

  • https://www.mapbox.com/studio/classic/styles/
  • https://www.mapbox.com/mapbox-studio-classic/

这篇关于添加自定义地图样式Mapbox.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆