【问题标题】:Adding new Basemap to Arcgis map using React使用 React 将新底图添加到 Arcgis 地图
【发布时间】:2021-05-16 07:44:03
【问题描述】:

Arcgis 开发者网页中,有一篇文章介绍了如何使用自定义API url 添加新的自定义baseMap。看起来像这样:

require([
    "esri/basemaps",
    "esri/map",
    "dojo/domReady!"
  ], function (esriBasemaps, Map){
    esriBasemaps.delorme = {
      baseMapLayers: [{url: "https://services.arcgisonline.com/ArcGIS/rest/services/Specialty/DeLorme_World_Base_Map/MapServer"}
      ],
      thumbnailUrl: "https://www.example.com/images/thumbnail_2014-11-25_61051.png",
      title: "Delorme"
    };

    var map = new Map("ui-map", {
      basemap: "delorme",
      center: [-111.879655861, 40.571338776], // long, lat
      zoom: 13,
      sliderStyle: "small"
    });
});

现在我不明白如何使用react-arcgis 来做同样的事情。似乎react-arcgis 中没有内置方法可以使用custom API url`` as BaseMapbut is there an option to do something similar inReact`?

this.props.map.basemap = 'streets-relief-vector';

而不是使用内置的底图字符串。

还创建了一个简单的CodeSandbox 来测试它。

【问题讨论】:

    标签: reactjs arcgis arcgis-js-api esri-maps


    【解决方案1】:

    你可以这样设置底图

    <Map mapProperties={{ basemap: "streets-relief-vector" }}>

    【讨论】:

    • 但是我有一个自定义 URL,我想从中设置我的底图。
    猜你喜欢
    • 2020-10-21
    • 2018-07-12
    • 2021-02-01
    • 2015-10-27
    • 2014-12-04
    • 2016-03-28
    • 1970-01-01
    • 2015-05-28
    • 1970-01-01
    相关资源
    最近更新 更多