简体   繁体   English

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

[英]Arcgis js 4.11: How to add basemap layer to basemap gallery

How to add basemap in basemap gallery.如何在底图库中添加底图。 In default BasemapGallery class, we have only 5 basemap layers.在默认的 BasemapGallery 类中,我们只有 5 个底图图层。 But how we can add another/custom basemap layer to that BasemapGallery?但是我们如何向该 BasemapGallery 添加另一个/自定义底图图层?

Here is the default layers provided by BasemapGallery.这是 BasemapGallery 提供的默认图层。

在此处输入图片说明

But I want to add more basemap layers like:-但我想添加更多底图图层,例如:-

在此处输入图片说明

Please help on this.请帮忙解决这个问题。

Firstly you need to create a group inside arcgis account.首先,您需要在 arcgis 帐户中创建一个组。 Here is the documentation of create group and how you can add custom basemaps to the group. 是创建组的文档以及如何向组添加自定义底图。

After it open group and copy id from url在它打开组并从 url 复制 id 之后

在此处输入图片说明

And use below code in you application to add basemap gallary on the map并在您的应用程序中使用以下代码在地图上添加底图库

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');

After that you will get this output之后你会得到这个输出

在此处输入图片说明

I hope it will help you.我希望它会帮助你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM