I have two things I want to perform with geopackage files. Only vector polygone layers I want to work with. 1/ access specific layer within given geopackage and retrieve rows from it (attribute table when working in QGIS) 2/ I have coordinates and I want to search for polygone in which the point exists, in specific layer of geopackage. I want to retrieve whole row of such polygone (like in QGIS layer's attribute table). I know the GeoTools covers this functionality, but never used such geo library and I do not know how to work with it. When I copied some examples from web, there are still occuring some errors. I work in NetBeans, I download the GeoTools jars, created new Library and added it to my project. project explorer Can anybody give me complete functioning example?
I tried this piece of code:
GeoPackageReader reader;
try {
reader = new GeoPackageReader(getClass().getResource("USJ_hranice_0.gpkg"), null);
System.out.println(Arrays.asList(reader.getGridCoverageNames()));
} catch (IOException ex) {
System.out.println(ex.getMessage());
}
And this error occurs:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/measure/UnconvertibleException
at org.geotools.referencing.crs.DefaultEngineeringCRS.<clinit>(DefaultEngineeringCRS.java:78)
at org.geotools.referencing.factory.epsg.CartesianAuthorityFactory.<clinit>(CartesianAuthorityFactory.java:54)
at org.geotools.coverage.grid.io.AbstractGridFormat.<clinit>(AbstractGridFormat.java:89)
at org.geotools.geopkg.mosaic.GeoPackageReader.<init>(GeoPackageReader.java:102)
at Main.Test.test(Test.java:22)
at Main.Main.main(Main.java:20)
Caused by: java.lang.ClassNotFoundException: javax.measure.UnconvertibleException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 6 more