他们正在尝试使用一个带有ESRI JS API 4的搜索小部件。我使用的源是webmap中的一个层。使用图层(按名称查找)非常缓慢,但它只有250个特征。将该层作为特征层添加到webmap(而不是一个项目)解决了这个问题,但它没有分组,并且位于相关层之上。我是否使用了错误的小部件?我能做些什么来缩短搜索时间吗?如果没有-是否有一种方法来移动功能层下的项目在网络地图?我可以自己分组图层吗?(另一层分组是巨大的,不能完全绘制为一个featureLayer,所以我想把它分组为mapImageLayer,同时保持源作为一个特征层)这里的代码我使用:从“@arcgis/core/layers/ layer”导入层;从“@arcgis/core/views/MapView”导入MapView import Search from "@arcgis/core/widgets/Search"; export default function AddSearchWidget(view: MapView, layer: Layer) { const source = { name: "river status", layer: layer, searchFields: ["label"], displayField: "label", exactMatch: false, outFields: ["label"], placeholder: "For example: Nile river" }; const searchWidget = new Search({ view: view, //activeSourceIndex:-1, allPlaceholder: "address river name", sources: [source] }); // Adds the search widget below other elements in // the top left corner of the view view.ui.add(searchWidget, { position: "top-right", index: 2 }); }
…查看更多