qq_40659993
Saxon-1
采纳率100%
2020-08-10 16:00

关于ArcGis Runtime For Android加载ArcGis导出的shapefile

目的

    通过ShapfileFeatureTable加载本地shapfile数据

###文件位置
已将shp数据(.dbf、.sbn、.sbx、.shp、.shx)存入移动端

图片说明

问题描述

    在实例化ShapefileFeatureTable对象时,显示为null

###调用方法

public void LoadShapFile(String shpPath, ArcGISMap mArcGISMap) {
        // 构建ShapefileFeatureTable,引入本地存储的shapefile文件
        ShapefileFeatureTable shapefileFeatureTable = new ShapefileFeatureTable(shpPath);
        shapefileFeatureTable.loadAsync();

        // 构建featureLayerr
        mFeatureLayer = new FeatureLayer(shapefileFeatureTable);
        // 设置Shapefile文件的渲染方式
        SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.RED, 1.0f);
        SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.YELLOW, lineSymbol);
        SimpleRenderer renderer = new SimpleRenderer(fillSymbol);
        mFeatureLayer.setRenderer(renderer);

        //设置选中颜色
        mFeatureLayer.setSelectionWidth(5);
        mFeatureLayer.setSelectionColor(Color.GREEN);

        //mMapView.setViewpointGeometryAsync(mFeatureLayer.getFullExtent());
        // 添加到地图的业务图层组中
        mArcGISMap.getOperationalLayers().add(mFeatureLayer);
    }

调试照片

图片说明

请各位大佬指点指点!

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答