Arcgis js 4.11:如何将底图图层添加到底图库

时间:2019-04-04 11:03:59

标签: javascript arcgis arcgis-js-api

如何在底图图库中添加底图。在默认的BasemapGallery类中,我们只有5个底图图层。但是我们如何向该BasemapGallery中添加另一个/自定义底图图层?

这是BasemapGallery提供的默认图层。

enter image description here

但是我想添加更多的底图图层,例如:-

enter image description here

请对此提供帮助。

1 个答案:

答案 0 :(得分:3)

首先,您需要在arcgis帐户中创建一个组。 Here是创建组的文档,以及如何向该组添加自定义底图。

打开组并从URL复制ID

enter image description here

并在您的应用程序中使用以下代码在地图上添加底图画廊

let basemapGallery = new BasemapGallery({
  source: { // autocasts as PortalBasemapsSource
    query: {
      //title: "ArcGIS Online Basemaps",owner: "esri"
      id: '702026e41f6641fb85da88efe79dc166'
    }
  },
  view: view
});

view.ui.add(basemapGallery, 'bottom-left');

之后,您将获得此输出

enter image description here

希望它能对您有所帮助。

相关问题