Giter VIP home page Giter VIP logo

ngageoint / geopackage-java Goto Github PK

View Code? Open in Web Editor NEW
79.0 19.0 26.0 29.13 MB

GeoPackage Java Library

Home Page: http://ngageoint.github.io/geopackage-java

License: MIT License

Java 100.00% Shell 0.01%
geopackage-java geopackage-tiles geopackage-libraries nga geopackage geopackage-functionality java java-library java-sdk java-libraries java-api geopackage-extension geopackage-standards geopackage-related-tables

geopackage-java's Issues

Example on how to add features to a gpkg missing

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.

FeatureResultSet.moveToFirst() does nothing.

Please fill out as much known and relevant information as possible.

Version Information:

  • GeoPackage Java Version: 3.4.0
  • GeoPackage Java Source: Maven repo
  • IDE Name & Version: IntelliJ march 2020 version
  • Java Version: JDK 1.8
  • Platform & OS: Windows

Expected Results:

  • What did you expect to happen?

Expected cursor to move to the first row of the table

Observed Results:

  • What happened instead?
    Cursor didnt move at all
  • How often does this occur?
    100%

Output:

  • Any logs, errors, or output messages?
    0
    1
    2
    2

Steps to Reproduce:

  1. Create a non empty FeatureResultSet by querying a DAO
  2. Print resultSet.getPosition()
  3. Call resultSet.moveToNext()
  4. Repeat 2, 3 as many times as you want
  5. Call resultSet.moveToFirst()
  6. Print resultSet.getPosition()

Relevant Code:

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());

Test Files:

  • Links to any files needed for testing?

Additional Information:

  • Any additional configuration, data, or information that might help with the issue?

getTileDao thread safety

Reported by a NGA opensphere developer

Version Information:

  • GeoPackage Java Version: 1.3.0

Expected Results:

  • Successful threaded calls to GeoPackage.getTileDao(layer)

Observed Results:

  • Errors due to unsafe threading on SimpleDateFormat

Output:

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

Steps to Reproduce:

Threaded calls to: myGeoPackage.getTileDao(layer);

Relevant Code:

myGeoPackage.getTileDao(layer);

Additional Information:

  • Temporarily fixed by synchronizing the getTileDao call

Efficient way to get unique values from a column

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

Case sensitive geometry column name comparison causes exception

Please fill out as much known and relevant information as possible.

Version Information:

  • GeoPackage Java Version: 3.0.2
  • GeoPackage Java Source: mvn central repo
  • IDE Name & Version: Intellij 2018.2
  • Maven Version: (mvn -version) n/a
  • Java Version: (java -version) 1.8.0_161
  • Platform & OS: MacOS 10.13.6
  • Other Relevant Libraries:
    • Gradle 4.7

Expected Results:

  • What did you expect to happen?
    • Case insensitive comparison of column names

Observed Results:

  • What happened instead?
  • Difference in geometry column name definition of "shape" and usage of "Shape" causes column not to be recognized as a geometry column and an exception thrown.
  • How often does this occur?
    • Every time geopackage with a geometry column name case mismatch is loaded

Output:

  • Any logs, errors, or output messages?
    Error importing table rad_impwtmdls_a
    java.lang.IllegalArgumentException: No enum constant mil.nga.geopackage.db.GeoPackageDataType.MULTIPOLYGON
    at java.lang.Enum.valueOf(Enum.java:238)
    at mil.nga.geopackage.db.GeoPackageDataType.valueOf(GeoPackageDataType.java:11)
    at mil.nga.geopackage.db.GeoPackageDataType.fromName(GeoPackageDataType.java:130)
    at mil.nga.geopackage.features.user.FeatureTableReader.createColumn(FeatureTableReader.java:60)
    at mil.nga.geopackage.features.user.FeatureTableReader.createColumn(FeatureTableReader.java:15)
    at mil.nga.geopackage.user.UserCoreTableReader.readTable(UserCoreTableReader.java:160)

Steps to Reproduce:

  1. Download test file (see link below)

  2. Load the gpkg

  3. Attempt to get dao for one of the feature tables

  4. Open test file in a db viewer

  5. View table gpkg_geometry_columns

  6. Note the column_name values are of shape

  7. View the table rad_303d_p

  8. Note the name of the geometry column is Shape

Relevant Code:

String tableName = "rad_303d_p";
geoPackage.getFeatureDao(tableName);

Test Files:

Additional Information:

  • Any additional configuration, data, or information that might help with the issue?

Possible memory leak

Please fill out as much known and relevant information as possible.

Version Information:

  • GeoPackage Java Version: 3.0.2
  • GeoPackage Java Source: Maven Central
  • IDE Name & Version: IntelliJ 2018.1
  • Maven Version: -
  • Java Version: $ java -version
    java version "1.8.0_181"
    Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
  • Platform & OS: Windows 10
  • Other Relevant Libraries:

Expected Results:

  • What did you expect to happen?
    When executing my test (copied below), which is opening and closing GeoPackages, I expected to only have a small foot print in the heap space.

Observed Results:

  • What happened instead? Memory consumption continuously increased until JVM exits with GC overhead limit exceeded. Checking the VM with VisualVM two ormlite classes consume nearly half of the heap space:
    ** com.j256.ormlite.field.DatabaseFieldConfig; 107.903.760 bytes (26.4%); 899.198 instances (14.2%)
    ** com.j256.ormlite.field.FieldType; 86.323.008 bytes (21.1%); 899.198 instances (14.2%)
  • How often does this occur? Every time.

Output:

  • Any logs, errors, or output messages?
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()));
    }
}

Test Files:

  • Links to any files needed for testing? Unfortunately I cannot provide any GeoPackages for testing this issue.

Additional Information:

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

image1
image2

Adding a NULL time fails even with default

Please fill out as much known and relevant information as possible.

Version Information:

  • GeoPackage Java Version: 1.2.2
  • GeoPackage Java Source: (e.g. Central Repository, Release, Source Code Build) Local source code build after cloning trunk from GitHub
  • IDE Name & Version: Eclipse 4.6.3
  • Maven Version: (mvn -version) 3.3.9
  • Java Version: (java -version) 1.8.0_72
  • Platform & OS: MAC OSX 10.11.6
  • Other Relevant Libraries:

Steps to reproduce

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());

Expected Results:

  • Row inserted properly, no SQL errors

Observed Results:

SQL error on insert (NULL constraint violated)
(Always)

Output:

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

Relevant Code:

// Code to reproduce the problem?

Test Files:

  • Links to any files needed for testing?

Additional Information:

  • Any additional configuration, data, or information that might help with the issue?

I need to know whether the problem is with the default mechanism or the test or the library

`org.slf4j:slf4j-nop` SLF4J binding imposed in `mil.nga.geopackage:geopackage`

Version Information:

  • GeoPackage Java Version: 6.6.5
  • GeoPackage Java Source: Mvn Central
  • IDE Name & Version: Java 21
  • Maven Version: 3.9.1
  • Java Version: openjdk version "21.0.2" 2024-01-16
  • Platform & OS: Linux
  • Other Relevant Libraries: log4j-slf4j2-impl 2.23.1 used in Planetiler project (https://github.com/onthegomap/planetiler)

Expected Results:

log4j-slf4j2-impl to be used as SLF4J binding without warnings

Observed Results:

Warning being printed by Planetiler, see "Output" bellow.

Output:

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]

Steps to Reproduce:

  1. Compile current Planetiler/main branch
  2. Run it

Relevant Code:

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

Test Files:

no

Additional Information:

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.

Support for Google Maps SDK for Android v3.0 Beta?

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?

Tile Generator and implementations

Similar to Android and iOS, we should have an abstract Tile Generator with implementations for URLs and features. A stand alone Feature Tiles implementation should be created and used by the generator.

Tile DAO get Bounding Box and Tile Grid at a zoom level

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.

GeoPackage.getFeatureDao() fails if geopackage uses RTree and file is not writable

Version Information:

  • GeoPackage Java Version: 6.3.0
  • GeoPackage Java Source: Maven Central
  • IDE Name & Version: IntelliJ IDEA 2021.02 CE
  • Maven Version: none, using gradle 6.8.2
  • Java Version: OpenJDK 64-Bit Server VM AdoptOpenJDK (build 15.0.2+7, mixed mode, sharing)
  • Platform & OS: x64, Windows 10 Pro
  • Other Relevant Libraries: org.xerial.sqlite-jdbc 3.36.0.3

Expected Results:

  • What did you expect to happen?

When reading a geopackage from a read-only file, as long as performing read operations, no errors should occur

Observed Results:

  • 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.

Output:

  • Any logs, errors, or output messages?
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]

Steps to Reproduce:

  1. Create/get a gpkg file with RTree extensions
  2. Open the file in another program on an OS that disallows writing to a file when that file is also opened by another process
  3. GeoPackageManager.open() said file
  4. geoPackage.getFeatureDao("some_table")

Relevant Code:

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.

Test Files:

https://service.pdok.nl/bzk/brogmwvolledigeset/atom/v2_1/downloads/brogmwvolledigeset.zip

Additional Information:

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

NSG Profile Support

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.