gpt4 book ai didi

javascript - 为什么要素层不解析 NSW MapServer 为 javascript API 4.1.1 提供的 DEBBaseMap?

转载 作者:行者123 更新时间:2023-11-30 19:24:40 24 4
gpt4 key购买 nike

我一直在尝试实现 NSW 为 DEPBaseMap 提供的 javascript API。该图层也可以添加到 ArcGIS Online 上并且可以正常使用,但是使用 JS API 做同样的事情,没有解决 map 。我想我的 javascript 中的代码遗漏了一些东西,因为包括新南威尔士州规划门户在内的其他功能层对我很有用。

        var map = new Map({
basemap: "topo-vector"

});

var view = new MapView({
container: "viewDiv",
map: map,
center: [-118.27928, 34.13558],
zoom: 18
});

var baseLayer= new FeatureLayer({
url: "https://mapprod1.environment.nsw.gov.au/arcgis/rest/services/Basemap/DPEBasemap/MapServer"
});

map.add(baseLayer);

预期的输出应该是这样的 Expected outcome hyperlink Expected outcome(Zoom out) Expected outcome(Zoom in)

这就是我的代码 my output(Zoom out)

最佳答案

上面的url指向一个map service .因此,与其将其添加为 FeatureLayer,不如使用 TileLayer一切都像在 ArcGIS Online Map Viewer 中一样工作。

var baseLayer= new TileLayer({
url: "https://mapprod1.environment.nsw.gov.au/arcgis/rest/services/Basemap/OEHBasemapNPWSHillshade/MapServer"
});
map.add(baseLayer);

有关使用最新 ArcGIS API for JavaScript 的现场演示,请参阅以下 CodePen: https://codepen.io/arnofiva/pen/21dd5c26558b140fde4622862516cff4

关于javascript - 为什么要素层不解析 NSW MapServer 为 javascript API 4.1.1 提供的 DEBBaseMap?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57051402/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com