arcgis api for javascript 4.x, 删除绘制的点、线、面

1、在视图mapView 上添加的点线面

// 删除所有
mapView.graphics.removeAll();

// 删除一个
const pointGraphic = new Graphic({geometry, symbol})
mapView.graphics.remove(pointGraphic);

// 删除多个
mapView.graphics.removeMany([pointGraphic, polylineGraphic]);

2、GraphicsLayer图层上的点线面

const pointGraphicLayer= new GraphicsLayer();  // 图层

// 删除所有
pointGraphicLayer.removeAll();

// 删除一个
const pointGraphic = new Graphic({geometry, symbol})
pointGraphicLayer.remove(pointGraphic);

// 删除多个
pointGraphicLayer.removeMany([pointGraphic, polylineGraphic]);
posted @ 2023-09-19 09:07  ZerlinM  阅读(345)  评论(0编辑  收藏  举报