ArcGIS Android 100.9 SHP文件加载失败的问题

ArcGIS Android 100.9   SHP文件加载失败的问题
这个地图为地方林业提供, 地图是XiAn80的地图。
81F4A229-517A-4bf2-A590-42CCDD50DE8B.png
已邀请:

鲁仁华

赞同来自:

同样的代码,我加载ArcGIS Pro网上下载的 Aurora_CO_shp 下的Subdivisions.shp    ,是成功的

张佳期

赞同来自:

我这边测试加载xi'an1980的高斯投影坐标系的数据能够在runtime for android100.9下显示。
可以在arcmap检查一下你的数据是否有几何错误,或者用我附件的数据试试。
图1.jpg

 
代码:
package com.esri.arcgisruntime.sample.featurelayershapefile;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import com.esri.arcgisruntime.data.ShapefileFeatureTable;
import com.esri.arcgisruntime.layers.FeatureLayer;

import com.esri.arcgisruntime.mapping.ArcGISMap;
import com.esri.arcgisruntime.mapping.Basemap;
import com.esri.arcgisruntime.mapping.view.MapView;

import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;

import android.Manifest;
import android.content.pm.PackageManager;

import com.esri.arcgisruntime.geometry.GeometryType;

public class MainActivity extends AppCompatActivity {

private ArcGISMap mainArcGISMap;

private FeatureLayer mainShapefileLayer;
private MapView mMapView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

mMapView = (MapView) findViewById(R.id.mapView);
mainArcGISMap = new ArcGISMap(Basemap.createStreetsVector());
mMapView.setMap(mainArcGISMap);

String reqPermission = new String{Manifest.permission.WRITE_EXTERNAL_STORAGE};
int requestCode = 2;
if (ContextCompat.checkSelfPermission(this, reqPermission[0]) == PackageManager.PERMISSION_GRANTED) {
showShapefile();
} else {
ActivityCompat.requestPermissions(this, reqPermission, requestCode);
}
}

private void showShapefile() {

// load the shapefile with a local path
final ShapefileFeatureTable shapefileFeatureTable = new ShapefileFeatureTable(
getExternalFilesDir(null) + getString(R.string.shapefile_path));

shapefileFeatureTable.loadAsync();
shapefileFeatureTable.addDoneLoadingListener(new Runnable() {
@Override
public void run() {
GeometryType gt = shapefileFeatureTable.getGeometryType();
String name = shapefileFeatureTable.getTableName();
mainShapefileLayer = new FeatureLayer(shapefileFeatureTable);
if (mainShapefileLayer.getFullExtent() != null) {
mMapView.setViewpointGeometryAsync(mainShapefileLayer.getFullExtent());
} else {
mainShapefileLayer.addDoneLoadingListener(new Runnable() {
@Override
public void run() {
mMapView.setViewpointGeometryAsync(mainShapefileLayer.getFullExtent());
}
});
}
mainArcGISMap.getOperationalLayers().add(mainShapefileLayer);

}
});
}

@Override
protected void onPause() {
super.onPause();
mMapView.pause();
}

@Override
protected void onResume() {
super.onResume();
mMapView.resume();
}

@Override
protected void onDestroy() {
super.onDestroy();
mMapView.dispose();
}

}

要回复问题请先登录注册