arcgis修改点线面位置的关键点

arcgis地图展示多边形

首先这里建议使用arcgis的GEO数据处理方式

// create and load the service geodatabase
        ServiceGeodatabase serviceGeodatabase =  new ServiceGeodatabase(url);
        serviceGeodatabase.loadAsync();
        serviceGeodatabase.addDoneLoadingListener(() -> {});
  1. 通过地图上点击查询或元素字段查询等办法,找到对应的标识物feature。点击查询的标识物在 Result.getElements()中取第一个get(0)。
    call get on the future to get the result

  2. layer.selectFeature(feature)为选中,可加选后的效果

  3. 创建新的点线面对象

    point,polyline,polygon(geometry) 
    

    point的创建

        // create a point geometry with a location and spatial reference
    // Point(latitude, longitude, spatial reference)
    val point = Point(-118.8065, 34.0005, SpatialReferences.getWgs84())
    

    polyline的创建

    // create a point collection with a spatial reference, and add three points to it
    val polylinePoints = PointCollection(SpatialReferences.getWgs84()).apply {
        // Point(latitude, longitude)
        add(Point(-118.8215, 34.0139))
        add(Point(-118.8148, 34.0080))
        add(Point(-118.8088, 34.0016))
    }
    
    // create a polyline geometry from the point collection
    val polyline = Polyline(polylinePoints)
    

    polygon的创建

    // create a point collection with a spatial reference, and add five points to it
    val polygonPoints = PointCollection(SpatialReferences.getWgs84()).apply {
        // Point(latitude, longitude)
        add(Point(-118.8189, 34.0137))
        add(Point(-118.8067, 34.0215))
        add(Point(-118.7914, 34.0163))
        add(Point(-118.7959, 34.0085))
        add(Point(-118.8085, 34.0035))
    }
    // create a polygon geometry from the point collection
    val polygon = Polygon(polygonPoints)
    
  4. 使用之前找标识物的对象进行修改

    feature.setGeometry(geometry); 
    

    使用新的点线面进行替换

  5. GEO数据更新提交

    updateFeatureAsync(feature) 
    

    具体代码如下:

    //类似添加操作
    		  try {
        // add the feature to the local table
        val addFeatureFuture: ListenableFuture<Void>  = damageTable.addFeatureAsync(arcgisFeature)
        
        // Update the feature on the local table.
    	 //damageTable.updateFeatureAsync(arcgisFeature)
    	 
        addFeatureFuture.addDoneListener {
          // If the feature table is a service feature table, then
          // apply edits to its service geodatabase
          ...
        }
      } catch (e: Exception) {
          e.printStackTrace()
      }
    
  6. apply edits once the update has completed( apply edits to its service geodatabase)。发现这一步有时不添加,结果也能成功。尽量参考官方文档,加上这一步的操作比较好点。

以上是arcgis点线面等位置修改的详细思路,需要使用GEO数据服务方式。因为之前只使用ServiceFeatureTable服务方式后,发现结果没有变化。如果有不对或更好的思路,可以告诉我,相互交流学习。

arcgis几何空间对象GEOMETRY接口,参考文档网址如下:
https://developers.arcgis.com/android/spatial-and-data-analysis/geometry/

https://developers.arcgis.com/android/query-and-edit/edit/

  • 19
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值