我正在尝试使用react JS在ArcGIS地图中添加一个点/线。现在我的地图工作得很好。我指的是https://github.com/odoe/jsapi-react链接。但是他们使用JavaScript的ArcGIS API在地图上添加带有图形和GraphicsLayer的点。我一直遵循这种方法来显示地图https://www.esri.com/about/newsroom/arcuser/react-arcgis/,我正在尝试添加用于在地图上添加点的图形和GraphicsLayer模块。谁能帮助我如何添加图形和GraphicsLayer也如何在这张地图上添加点或线。下面是我的app.js代码。
import WebMap from "esri/WebMap";
import MapView from "esri/views/MapView";
import Search from "esri/widgets/Search";
import FeatureLayer from "esri/layers/FeatureLayer";
const noop = () => {};
export const webmap = new WebMap({
portalItem: {
id: "974c6641665a42bf8a57da08e607bb6f"
}
});
export const view = new MapView({
map: webmap
});
export const search = new Search({ view });
view.ui.add(search, "top-right");
export const initialize = (container) => {
view.container = container;
view
.when()
.then(_ => {
console.log("Map and View are ready");
})
.catch(noop);
return () => {
view.container = null;
};
};
谢谢。
发布于 2021-05-14 14:02:44
这里有一个示例:https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=intro-graphics。如果您需要了解其他一些功能,如果您转到description页面,您将看到数以百计的其他示例:https://developers.arcgis.com/javascript/latest/sample-code/intro-graphics/。
https://stackoverflow.com/questions/67154237
复制相似问题