【发布时间】:2019-02-26 10:21:19
【问题描述】:
谁能告诉我如何使用 WhirlyGlobe SDK 在 Android 中显示本地 shapefile?
我正在使用 readFromFile 但我总是错误的。 http://mousebird.github.io/WhirlyGlobe/reference/android_2_5/index.html
我的代码:字符串是带有 shapefile 的文件夹的路径
@Override
protected void onPostExecute(String string) {
VectorInfo vectorInfo = new VectorInfo();
vectorInfo.setColor(Color.RED);
vectorInfo.setLineWidth(4.f);
VectorObject object = new VectorObject();
File fileShape = new File(string + "/poly.shp");
String shapefile = "";
if (fileShape .exists()){
shapefile = fileShape.getAbsolutePath();
}
if(object.readFromFile(shapefile)){
controller.addVector(object,vectorInfo,MaplyBaseController.ThreadMode.ThreadAny);
}
//if (object1.fromGeoJSON(shapefile)) {
// controller.addVector(object, vectorInfo, MaplyBaseController.ThreadMode.ThreadAny);
//}
}
GeoJSON 的示例运行良好。 http://mousebird.github.io/WhirlyGlobe/tutorial/android/vector-data.html
【问题讨论】:
标签: java android gis shapefile