美文网首页Android
Arcgis for Android加载.geodatabase

Arcgis for Android加载.geodatabase

作者: 曾经的追风少年 | 来源:发表于2018-10-08 16:12 被阅读476次
    使用arcgis for android 10.2.x中加载离线地图,使用tpk + geodatabase模式:

    1、初始化tpk文件

    // 初始化离线切片
    String yxtPath = Environment.getExternalStorageDirectory() + File.separator + "ArcGis" + File.separator + "yxt.tpk";
    ArcGISLocalTiledLayer yxtLayer = new ArcGISLocalTiledLayer(yxtPath);
    mMapView.addLayer(yxtLayer);
    

    1、初始化geodatabase文件

    // 离线地图geodatabase文件路径
    String path = Environment.getExternalStorageDirectory() + File.separator + "ArcGis" + File.separator + "xxx.geodatabase";
    Geodatabase localGdb = null;
    try {
        localGdb = new Geodatabase(path);
    } catch (Exception e) {
        e.printStackTrace();
    }
    if (localGdb != null) {
        for (GeodatabaseFeatureTable gdbFeatureTable : localGdb.getGeodatabaseTables()) {
            if (gdbFeatureTable.hasGeometry()) {
                FeatureLayer featureLayer = new FeatureLayer(gdbFeatureTable);
                mMapView.addLayer(featureLayer);
            }
        }
    }
    

    相关文章

      网友评论

        本文标题:Arcgis for Android加载.geodatabase

        本文链接:https://www.haomeiwen.com/subject/eykboftx.html