arcGis 4.11版本Graphic动态控制图层显隐

系统管理员 2021-12-10 12:23 510阅读 0赞

  因为项目需要使用,所以最近找了下Graphic图层的显隐控制。但是之前的很多博客所说的hide和show方法在api中并没有(可能是版本更新给干掉了吧)。然后就查了查arcGis For js 找了一个折中方法,供大家参考。如果大家有其他更好的方案可以提出来,共同进步。

  首先是创建Graphic对象

  1. 1 var point = {
  2. 2 type : "point", // autocasts as new Polyline()
  3. 3 longitude : 114,
  4. 4 latitude:96
  5. 5 };
  6. 6 var markerSymbol = {
  7. 7 type : "simple-marker", // autocasts as SimpleLineSymbol() 9  color : "rgba(255,0,0,1)"
  8. 10 };
  9. 11 var pointGraphicName="point"+areaArr[a].objectid;
  10. 12 var graphic= new self.param.Graphic({
  11. 13 geometry : point, // Add the geometry created in step 4
  12. 14 symbol : markerSymbol,16 visible:true
  13. 17 })

  然后存入到graphics,然后控制显隐其实就是graphics添加和删除要素图层

  1. view.graphics.add(graphic);
  2. view.graphics.remove(graphic);

转载于:https://www.cnblogs.com/smlPig/p/10931649.html

发表评论

表情:
评论列表 (有 0 条评论,510人围观)

还没有评论,来说两句吧...

相关阅读

    相关 ArcGIS介绍

    ArcGIS图层介绍 什么是图层 图层是用来在 ArcGIS 产品套件中显示地理数据集的机制。每个图层代表一种数据集(可以是地图服务、图形或是矢量数据),并指定该数据集是如