ngageoint / geopackage-java Goto Github PK
View Code? Open in Web Editor NEWGeoPackage Java Library
Home Page: http://ngageoint.github.io/geopackage-java
License: MIT License
GeoPackage Java Library
Home Page: http://ngageoint.github.io/geopackage-java
License: MIT License
Consider supporting the OGC GeoPackage Extension for Tiled Gridded Coverage Data (17-066r1) http://docs.opengeospatial.org/is/17-066r1/17-066r1.html
The document can be found on the main geopackage standard page https://www.opengeospatial.org/standards/geopackage
The extension provides the means of storing raster data such as GeoTIFF-encoded imagery in a GeoPackage.
Has anyone done or seen a feature comparison between the geopackage-java project and the geotools geopackage implementations? It would be useful in determining the value of using this project.
Thanks!
Sorry to bug you all a work. I'm trying to upgrade from 1.1.0 to 1.2.0
Looks like it was deleted or renamed with commit 3d253c4 in may of 2016. What's the replacement?
I am currently failing to use the library to create a GeoPackage file and write my feature data to it. I was not able to find an example in the readme file.
Would it be possible to add an example on how to add a simple Geometry like a Point to a newly created GeoPackage? This would include the creation of a "feature table" and the adding to the "geometry columns table".
As alternative I would be happy to get a simple answer to this question, but I guess there are other developers who would find this pretty helpful.
State your question
It appears that Google has a Maps SDK version (v3.0.0) in Beta that does not depend on play services, but instead is an aar library:
https://developers.google.com/maps/documentation/android-sdk/v3-client-migration
What this means though is that the dependency to TileProvider
, referenced in GeoPackageOverlayFactory
must now use a version from com.google.android.libraries.maps.*
instead of com.google.android.gms.maps.*
Is there any plans of supporting geopackage-java
that is compatible with the v3.0.0
version of Maps SDK in the near future?
Provide database min and max methods that retrieve the min/max value of a column using where criteria and arguments.
Please fill out as much known and relevant information as possible.
Expected cursor to move to the first row of the table
FeatureResultSet frs = dao.queryForAll();
System.out.println("Current pos: " + frs.getPostition());
frs.moveToNext();
System.out.println("Current pos: " + frs.getPostition());
frs.moveToNext();
System.out.println("Current pos: " + frs.getPostition());
frs.moveToFirst();
System.out.println("Current pos: " + frs.getPostition());
Add methods to query for the Tile Grid and Bounding Box of the existing tiles at a Tile Matrix zoom level. This could be the entire Tile Matrix Set bounding box or grid, or a subset if tiles are missing around the edges.
Please fill out as much known and relevant information as possible.
Download test file (see link below)
Load the gpkg
Attempt to get dao for one of the feature tables
Open test file in a db viewer
View table gpkg_geometry_columns
Note the column_name
values are of shape
View the table rad_303d_p
Note the name of the geometry column is Shape
String tableName = "rad_303d_p";
geoPackage.getFeatureDao(tableName);
Please fill out as much known and relevant information as possible.
In file /geopackage/src/test/java/mil/nga/geopackage/test/features/columns/GeometryColumnsUtils.java comment out line 530 in order to test the addition of a row to gpkg_contents with the default date.
// contents.setLastChange(new Date());
SQL error on insert (NULL constraint violated)
(Always)
Running mil.nga.geopackage.test.features.columns.GeometryColumnsCreateTest
Tests run: 4, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.465 sec <<< FAILURE!
testCreate(mil.nga.geopackage.test.features.columns.GeometryColumnsCreateTest) Time elapsed: 0.104 sec <<< ERROR!
java.sql.SQLException: Unable to run insert stmt on object mil.nga.geopackage.core.contents.Contents@1dc76ef1: INSERT INTO `gpkg_contents` (`table_name` ,`data_type` ,`identifier` ,`description` ,`last_change` ,`min_x` ,`min_y` ,`max_x` ,`max_y` ,`srs_id` ,`srs_id` ) VALUES (?,?,?,?,?,?,?,?,?,?,?)
at com.j256.ormlite.misc.SqlExceptionUtil.create(SqlExceptionUtil.java:25)
at com.j256.ormlite.stmt.mapped.MappedCreate.insert(MappedCreate.java:137)
at com.j256.ormlite.stmt.StatementExecutor.create(StatementExecutor.java:458)
at com.j256.ormlite.dao.BaseDaoImpl.create(BaseDaoImpl.java:328)
at mil.nga.geopackage.core.contents.ContentsDao.create(ContentsDao.java:79)
at mil.nga.geopackage.test.features.columns.GeometryColumnsUtils.testCreate(GeometryColumnsUtils.java:541)
at mil.nga.geopackage.test.features.columns.GeometryColumnsCreateTest.testCreate(GeometryColumnsCreateTest.java:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Caused by: org.sqlite.SQLiteException: [SQLITE_CONSTRAINT_NOTNULL] A NOT NULL constraint failed (NOT NULL constraint failed: gpkg_contents.last_change)
at org.sqlite.core.DB.newSQLException(DB.java:909)
at org.sqlite.core.DB.newSQLException(DB.java:921)
at org.sqlite.core.DB.execute(DB.java:825)
at org.sqlite.core.DB.executeUpdate(DB.java:863)
at org.sqlite.jdbc3.JDBC3PreparedStatement.executeUpdate(JDBC3PreparedStatement.java:99)
at com.j256.ormlite.jdbc.JdbcDatabaseConnection.insert(JdbcDatabaseConnection.java:183)
at com.j256.ormlite.stmt.mapped.MappedCreate.insert(MappedCreate.java:91)
... 38 more
Running mil.nga.geopackage.test.features.columns.GeometryColumnsImportTest
Tests run: 6, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.053 sec <<< FAILURE!
testCreate(mil.nga.geopackage.test.features.columns.GeometryColumnsImportTest) Time elapsed: 0.017 sec <<< ERROR!
java.sql.SQLException: Unable to run insert stmt on object mil.nga.geopackage.core.contents.Contents@6cb62e90: INSERT INTO `gpkg_contents` (`table_name` ,`data_type` ,`identifier` ,`description` ,`last_change` ,`min_x` ,`min_y` ,`max_x` ,`max_y` ,`srs_id` ,`srs_id` ) VALUES (?,?,?,?,?,?,?,?,?,?,?)
at com.j256.ormlite.misc.SqlExceptionUtil.create(SqlExceptionUtil.java:25)
at com.j256.ormlite.stmt.mapped.MappedCreate.insert(MappedCreate.java:137)
at com.j256.ormlite.stmt.StatementExecutor.create(StatementExecutor.java:458)
at com.j256.ormlite.dao.BaseDaoImpl.create(BaseDaoImpl.java:328)
at mil.nga.geopackage.core.contents.ContentsDao.create(ContentsDao.java:79)
at mil.nga.geopackage.test.features.columns.GeometryColumnsUtils.testCreate(GeometryColumnsUtils.java:541)
at mil.nga.geopackage.test.features.columns.GeometryColumnsImportTest.testCreate(GeometryColumnsImportTest.java:87)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Caused by: org.sqlite.SQLiteException: [SQLITE_CONSTRAINT_NOTNULL] A NOT NULL constraint failed (NOT NULL constraint failed: gpkg_contents.last_change)
at org.sqlite.core.DB.newSQLException(DB.java:909)
at org.sqlite.core.DB.newSQLException(DB.java:921)
at org.sqlite.core.DB.execute(DB.java:825)
at org.sqlite.core.DB.executeUpdate(DB.java:863)
at org.sqlite.jdbc3.JDBC3PreparedStatement.executeUpdate(JDBC3PreparedStatement.java:99)
at com.j256.ormlite.jdbc.JdbcDatabaseConnection.insert(JdbcDatabaseConnection.java:183)
at com.j256.ormlite.stmt.mapped.MappedCreate.insert(MappedCreate.java:91)
... 38 more
// Code to reproduce the problem?
State your question
I am looking for an efficient way to get something like a DISTINCT query to get unique values from a non-geometry column from a Geopackage table with many millions of objects. Iterating through all features takes several hours.
Additional context
The data in question is the transport network graph for all of Austria, which is available from here: https://www.data.gv.at/katalog/dataset/intermodales-verkehrsreferenzsystem-osterreich-gip-at-beta/resource/0434feec-210f-4a95-b60c-a948a0b291e9
When reading a geopackage from a read-only file, as long as performing read operations, no errors should occur
What happened instead?
When calling GeoPackage.getFeatureDao(String)
, the following exception is produced: java.sql.SQLException: error creating function
. The root cause is that RTreeIndexCoreExtension
tries to create some functions, but in the sqlite package the JNI function create_function
produces error code 5 (SQLITE_BUSY
, meaning the database file is locked).
How often does this occur?
Every time.
java.sql.SQLException: error creating function
at org.sqlite.Function.create(Function.java:124) ~[sqlite-jdbc-3.36.0.3.jar:na]
at org.sqlite.Function.create(Function.java:92) ~[sqlite-jdbc-3.36.0.3.jar:na]
at org.sqlite.Function.create(Function.java:80) ~[sqlite-jdbc-3.36.0.3.jar:na]
at mil.nga.geopackage.extension.rtree.RTreeIndexExtension.createFunction(RTreeIndexExtension.java:185) ~[geopackage-6.3.0.jar:na]
at mil.nga.geopackage.extension.rtree.RTreeIndexExtension.createMinYFunction(RTreeIndexExtension.java:123) ~[geopackage-6.3.0.jar:na]
at mil.nga.geopackage.extension.rtree.RTreeIndexCoreExtension.createAllFunctions(RTreeIndexCoreExtension.java:441) ~[geopackage-core-6.3.0.jar:na]
at mil.nga.geopackage.extension.rtree.RTreeIndexCoreExtension.createFunctions(RTreeIndexCoreExtension.java:348) ~[geopackage-core-6.3.0.jar:na]
at mil.nga.geopackage.extension.rtree.RTreeIndexCoreExtension.createFunctions(RTreeIndexCoreExtension.java:330) ~[geopackage-core-6.3.0.jar:na]
at mil.nga.geopackage.GeoPackageImpl.getFeatureDao(GeoPackageImpl.java:123) ~[geopackage-6.3.0.jar:na]
at mil.nga.geopackage.GeoPackageImpl.getFeatureDao(GeoPackageImpl.java:196) ~[geopackage-6.3.0.jar:na]
GeoPackageManager.open()
said filegeoPackage.getFeatureDao("some_table")
In GeoPackageImpl.getFeatureDao(GeometryColumns)
(GeoPackageImpl.java:121
):
if (writable) {
RTreeIndexExtension rtree = new RTreeIndexExtension(this);
rtree.createFunctions(featureTable);
}
But, there is no way to create a GeoPackage
instance that has writable == false
because it is hard-coded as the last argument of the super()
call in the constructor in GeoPackageImpl.java:73
:
super(name, path, database, true);
As the variable writable
is final
, there is no way around this.
https://service.pdok.nl/bzk/brogmwvolledigeset/atom/v2_1/downloads/brogmwvolledigeset.zip
I have verified that fudging writable = false
using reflection eliminates the exception and everything works as it should:
var writable = GeoPackageCoreImpl.class.getDeclaredField("writable");
writable.setAccessible(true);
writable.set(geoPackage, false);
var featureDao = geoPackage.getFeatureDao("my_table"); // now works even if file is opened elsewhere
The dependency https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc/3.40.0.0 has a vulnerability:
https://nvd.nist.gov/vuln/detail/CVE-2023-32697
a bump to 3.43.0 should fix it.
Please fill out as much known and relevant information as possible.
mil.nga.geopackage.GeoPackageException: Failed to create SpatialReferenceSystem dao
at mil.nga.geopackage.factory.GeoPackageCoreImpl.createDao(GeoPackageCoreImpl.java:938)
at mil.nga.geopackage.factory.GeoPackageCoreImpl.getSpatialReferenceSystemDao(GeoPackageCoreImpl.java:373)
at mil.nga.geopackage.validate.GeoPackageValidate.hasMinimumTables(GeoPackageValidate.java:61)
at mil.nga.geopackage.validate.GeoPackageValidate.validateMinimumTables(GeoPackageValidate.java:79)
at mil.nga.geopackage.manager.GeoPackageManager.open(GeoPackageManager.java:116)
at mil.nga.geopackage.manager.GeoPackageManager.open(GeoPackageManager.java:82)
at test.LoadTest.loadTest(LoadTest.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.sql.SQLException: Could not call the constructor in class class mil.nga.geopackage.core.srs.SpatialReferenceSystemDao
at com.j256.ormlite.misc.SqlExceptionUtil.create(SqlExceptionUtil.java:27)
at com.j256.ormlite.dao.DaoManager.createDao(DaoManager.java:95)
at mil.nga.geopackage.factory.GeoPackageCoreImpl.createDao(GeoPackageCoreImpl.java:935)
... 28 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.j256.ormlite.dao.DaoManager.createDao(DaoManager.java:92)
... 29 more
Caused by: java.sql.SQLException: Could not call the constructor in class class mil.nga.geopackage.core.contents.ContentsDao
at com.j256.ormlite.misc.SqlExceptionUtil.create(SqlExceptionUtil.java:27)
at com.j256.ormlite.dao.DaoManager.createDao(DaoManager.java:95)
at com.j256.ormlite.field.FieldType.configDaoInformation(FieldType.java:392)
at com.j256.ormlite.dao.BaseDaoImpl.initialize(BaseDaoImpl.java:206)
at com.j256.ormlite.dao.BaseDaoImpl.<init>(BaseDaoImpl.java:133)
at com.j256.ormlite.dao.BaseDaoImpl.<init>(BaseDaoImpl.java:112)
at mil.nga.geopackage.core.srs.SpatialReferenceSystemDao.<init>(SpatialReferenceSystemDao.java:67)
... 34 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.j256.ormlite.dao.DaoManager.createDao(DaoManager.java:92)
... 39 more
Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
at java.util.LinkedHashMap.newNode(LinkedHashMap.java:256)
at java.util.HashMap.putVal(HashMap.java:631)
at java.util.HashMap.put(HashMap.java:612)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:124)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
at java.lang.reflect.Field.declaredAnnotations(Field.java:1150)
at java.lang.reflect.Field.declaredAnnotations(Field.java:1148)
at java.lang.reflect.Field.getAnnotation(Field.java:1120)
at com.j256.ormlite.field.DatabaseFieldConfig.fromField(DatabaseFieldConfig.java:515)
at com.j256.ormlite.field.FieldType.createFieldType(FieldType.java:975)
at com.j256.ormlite.table.DatabaseTableConfig.extractFieldTypes(DatabaseTableConfig.java:241)
at com.j256.ormlite.table.DatabaseTableConfig.fromClass(DatabaseTableConfig.java:176)
at com.j256.ormlite.table.TableInfo.<init>(TableInfo.java:55)
at com.j256.ormlite.dao.BaseDaoImpl.initialize(BaseDaoImpl.java:156)
at com.j256.ormlite.dao.BaseDaoImpl.<init>(BaseDaoImpl.java:133)
at com.j256.ormlite.dao.BaseDaoImpl.<init>(BaseDaoImpl.java:112)
at mil.nga.geopackage.core.contents.ContentsDao.<init>(ContentsDao.java:63)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.j256.ormlite.dao.DaoManager.createDao(DaoManager.java:92)
at com.j256.ormlite.field.FieldType.configDaoInformation(FieldType.java:392)
at com.j256.ormlite.dao.BaseDaoImpl.initialize(BaseDaoImpl.java:206)
at com.j256.ormlite.dao.BaseDaoImpl.<init>(BaseDaoImpl.java:133)
at com.j256.ormlite.dao.BaseDaoImpl.<init>(BaseDaoImpl.java:112)
at mil.nga.geopackage.core.srs.SpatialReferenceSystemDao.<init>(SpatialReferenceSystemDao.java:67)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.j256.ormlite.dao.DaoManager.createDao(DaoManager.java:92)```
#### Steps to Reproduce:
1. Execute the test copied below.
#### Relevant Code:
```java
package test;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import org.junit.Test;
import mil.nga.geopackage.GeoPackage;
import mil.nga.geopackage.manager.GeoPackageManager;
public class LoadTest {
private static final Path BASE_DIR = Paths.get("D:\\Share\\GPKG");
private static final List<String> GPKG =
Arrays.asList([...]);
private static final Random RNG = new Random();
@Test
public void loadTest() {
for (int i = 0; i < 100_000; i++) {
GeoPackage geoPackage =
GeoPackageManager.open(BASE_DIR.resolve(randomGeoPackage()).toFile());
geoPackage.close();
}
}
private String randomGeoPackage() {
return GPKG.get(RNG.nextInt(GPKG.size()));
}
}
I added two screenshot, both from the same execution of the test.
Maybe I oversaw something important, but I think beside opening and closing a GeoPackage there are no further steps necessary. Please correct me if I am wrong.
And feel free to ask questions or request further details.
Cheers,
Marko Skocibusic
Reported by a NGA opensphere developer
FATAL:09/21/2017 21:25:28.726 [Envoy[GeoPackageImageEnvoy]-52] (io.opensphere.core.appl.UncaughtExceptionHandler:28) - Uncaught Exception: mil.nga.geopackage.GeoPackageException: Failed to retrieve TileDao for table name: tiles. Exception retrieving TileMatrixSet.
mil.nga.geopackage.GeoPackageException: Failed to retrieve TileDao for table name: tiles. Exception retrieving TileMatrixSet.
at mil.nga.geopackage.manager.GeoPackageImpl.getTileDao(GeoPackageImpl.java:250)
at io.opensphere.geopackage.envoy.GeoPackageImageEnvoy.query(GeoPackageImageEnvoy.java:126)
at io.opensphere.core.data.CachingDataRegistryDataProvider$1.run(CachingDataRegistryDataProvider.java:163)
at io.opensphere.core.data.DefaultQueryTracker$RunnableWrapper.run(DefaultQueryTracker.java:517)
at io.opensphere.core.util.lang.TaskCanceller$3.lambda$0(TaskCanceller.java:167)
at io.opensphere.core.util.lang.TaskCanceller$1.call(TaskCanceller.java:105)
at io.opensphere.core.util.lang.TaskCanceller$3.run(TaskCanceller.java:169)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at io.opensphere.core.util.concurrent.PausingThreadPoolExecutor$WorkerProxy.run(PausingThreadPoolExecutor.java:306)
at java.lang.Thread.run(Thread.java:745)
at io.opensphere.core.util.lang.NamedThreadFactory$1.run(NamedThreadFactory.java:84)
Caused by: java.sql.SQLException: Failed to parse date string: 2017-07-31T14:22:03.494Z
at mil.nga.geopackage.persister.DatePersister.sqlArgToJava(DatePersister.java:82)
at com.j256.ormlite.field.BaseFieldConverter.resultToJava(BaseFieldConverter.java:30)
at com.j256.ormlite.field.FieldType.resultToJava(FieldType.java:841)
at com.j256.ormlite.stmt.mapped.BaseMappedQuery.mapRow(BaseMappedQuery.java:61)
at com.j256.ormlite.jdbc.JdbcDatabaseConnection.queryForOne(JdbcDatabaseConnection.java:310)
at com.j256.ormlite.jdbc.JdbcDatabaseConnection.queryForOne(JdbcDatabaseConnection.java:224)
at com.j256.ormlite.stmt.mapped.MappedQueryForFieldEq.execute(MappedQueryForFieldEq.java:38)
at com.j256.ormlite.field.FieldType.createForeignObject(FieldType.java:1047)
at com.j256.ormlite.field.FieldType.assignField(FieldType.java:556)
at com.j256.ormlite.stmt.mapped.BaseMappedQuery.mapRow(BaseMappedQuery.java:72)
at com.j256.ormlite.stmt.SelectIterator.getCurrent(SelectIterator.java:284)
at com.j256.ormlite.stmt.SelectIterator.nextThrow(SelectIterator.java:168)
at com.j256.ormlite.stmt.StatementExecutor.query(StatementExecutor.java:202)
at com.j256.ormlite.dao.BaseDaoImpl.query(BaseDaoImpl.java:277)
at com.j256.ormlite.stmt.QueryBuilder.query(QueryBuilder.java:366)
at com.j256.ormlite.stmt.Where.query(Where.java:480)
at com.j256.ormlite.dao.BaseDaoImpl.queryForEq(BaseDaoImpl.java:253)
at mil.nga.geopackage.manager.GeoPackageImpl.getTileDao(GeoPackageImpl.java:244)
... 11 more
Caused by: java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Long.parseLong(Long.java:601)
at java.lang.Long.parseLong(Long.java:631)
at java.text.DigitList.getLong(DigitList.java:195)
at java.text.DecimalFormat.parse(DecimalFormat.java:2051)
at java.text.SimpleDateFormat.subParse(SimpleDateFormat.java:2162)
at java.text.SimpleDateFormat.parse(SimpleDateFormat.java:1514)
at java.text.DateFormat.parse(DateFormat.java:364)
at mil.nga.geopackage.db.DateConverter.dateValue(DateConverter.java:127)
at mil.nga.geopackage.persister.DatePersister.sqlArgToJava(DatePersister.java:80)
... 28 more
Threaded calls to: myGeoPackage.getTileDao(layer);
myGeoPackage.getTileDao(layer);
log4j-slf4j2-impl
to be used as SLF4J binding without warnings
Warning being printed by Planetiler, see "Output" bellow.
SLF4J(W): Class path contains multiple SLF4J providers.
SLF4J(W): Found provider [org.apache.logging.slf4j.SLF4JServiceProvider@49097b5d]
SLF4J(W): Found provider [org.slf4j.nop.NOPServiceProvider@6e2c634b]
SLF4J(W): See https://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J(I): Actual provider is of type [org.apache.logging.slf4j.SLF4JServiceProvider@49097b5d]
import mil.nga.geopackage.GeoPackage;
...
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
...
private static final Logger LOGGER = LoggerFactory.getLogger(Generate.class);
See for example https://github.com/onthegomap/planetiler/blob/main/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/GeoPackageReader.java
no
SLF4J suggests:
Embedded components such as libraries or frameworks should not declare a dependency on any SLF4J binding but only depend on slf4j-api. When a library declares a compile-time dependency on a SLF4J binding, it imposes that binding on the end-user, thus negating SLF4J's purpose. When you come across an embedded component declaring a compile-time dependency on any SLF4J binding, please take the time to contact the authors of said component/library and kindly ask them to mend their ways.
Has the GeoPackage JAVA library been updated to support the NGA's NSG GeoPackage Tiling Profile Specification? (NSG) GeoPackage Encoding Standard 2.0
Interoperability Standard
(2016-09-14)
Version 2.0
(NSG) GeoPackage Encoding Standard 2.0
Interoperability Standard
(2016-09-14)
Upgrade geopackage-core version from 1.1.0 to 1.1.1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.