【问题标题】:Load ESRI Vector Tiles in mapbox-gl在 mapbox-gl 中加载 ESRI 矢量图块
【发布时间】:2020-07-11 03:59:42
【问题描述】:

我正在使用 mapbox-gl v 1.8.0。我正在尝试使用 ArcGIS Online 服务加载 ESRI 矢量切片。这是我的代码sn-p

mapboxgl.accessToken = '<your access token here>';
var map = new mapboxgl.Map({
container: 'map', // container id
style: 'https://basemaps.arcgis.com/arcgis/rest/services/OpenStreetMap_GCS_v2/VectorTileServer/resources/styles/root.json', // stylesheet location
center: [-74.5, 40], // starting position [lng, lat]
zoom: 9 // starting zoom
});

是否需要创建访问令牌才能在 ArcGIS Online 中访问该样式?

非常感谢任何帮助!

【问题讨论】:

  • 那是公共服务,你应该不需要令牌
  • 您是否偶然找到了问题的解决方案?谢谢!

标签: vector tiles esri mapbox-gl


【解决方案1】:

这是一个很晚的回放,但是是的,您可以使用 MapBox 加载 Esri Vector 平铺底图图层和其他图层。是的,您需要注册一个免费帐户才能获得访问令牌。

      const apiKey = "YOUR_API_KEY";
      const basemapEnum = "ArcGIS:Streets";

      const map = new mapboxgl.Map({
        container: "map", // the id of the div element
        style: `https://basemaps-api.arcgis.com/arcgis/rest/services/styles/${basemapEnum}?type=style&token=${apiKey}`,
        zoom: 12, // starting zoom
        center: [-118.805, 34.027] // starting location [longitude, latitude]
      });

here获取完整代码

【讨论】:

    猜你喜欢
    • 2021-01-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-14
    相关资源
    最近更新 更多