geopackage table counter is zero?
Closed this issue · 1 comments
geopackge read test experiment encounter some issue need help
when i try read the local data, geopackage file, using sdk lib. Trouble thing show up, the table count number is zero.
so i think there may be some bug in the module in sdk lib. so i need to clear it.
here is my code block to read the geopackage table row count:
// instantiate geopackage with the path to the .gpkg file
com.esri.arcgisruntime.data.GeoPackage geoPackage =
new com.esri.arcgisruntime.data.GeoPackage(gpkg_path);
// load the geopackage
geoPackage.loadAsync();
geoPackage.addDoneLoadingListener(() -> {
if (geoPackage.getLoadStatus() == LoadStatus.LOADED) {
for(GeoPackageFeatureTable geoPackageFeatureTable:geoPackage.getGeoPackageFeatureTables()){
//GeoPackageFeatureTable geoPackageFeatureTable = geoPackage.getGeoPackageFeatureTables().get(0);
//String sr = geoPackageFeatureTable.getSpatialReference().getWKText();
long counter = geoPackageFeatureTable.getTotalFeatureCount();
String name = geoPackageFeatureTable.getTableName();
Log.e(TAG, String.format("%s: %d", name , counter));
//.....
}
}
});
geoPackage.close();
log as following when the feed the test data in my emulator in android sutdio.
test data brief info: 540,672 exp2.gpkg
P.S.: my test file is good, created by ArcGIS Pro Desktop App.
2022-07-25 22:14:21.936 11048-11048/com.fssg.pipemap E/FUtils: points: 0
2022-07-25 22:14:21.957 11048-11048/com.fssg.pipemap E/FUtils: lines: 0
2022-07-25 22:14:21.967 11048-11048/com.fssg.pipemap E/FUtils: polygon: 0
is anyguys have the same issue? or may be i miss something important to make the bad result.
call for help, plz, thx.
Hi there!
You need to load the geopackageFeatureTable
to get information about the tables from them.
So it needs to look like this INSIDE the for loop:
geoPackageFeatureTable.addDoneLoadingListener {
if (geoPackageFeatureTable.loadStatus == LoadStatus.LOADED) {
val counter = geoPackageFeatureTable.totalFeatureCount
val name = geoPackageFeatureTable.tableName
Log.e(TAG, String.format("%s: %d", name, counter))
}
}
That should get you sorted 👍