geoscript / geoscript-groovy

A Groovy implementation of GeoScript.
https://geoscript.net/groovy
MIT License
46 stars 22 forks source link

H2GIS workspace #77

Open ebocher opened 1 year ago

ebocher commented 1 year ago

Since H2GIS is in GeoTools (https://github.com/geotools/geotools/pull/4043) we can expose H2GIS in GeoScript.

jericks commented 1 year ago

This looks great! Thanks for the PR! Eventually, we should add a H2GIS section to https://jericks.github.io/geoscript-groovy-cookbook/

jericks commented 1 year ago

Any idea why the build can't find org.geotools.jdbc:gt-jdbc-h2gis:jar:29-SNAPSHOT?

Error: Failed to execute goal on project geoscript-groovy: Could not resolve dependencies for project org.geoscript:geoscript-groovy:jar:1.21.0-SNAPSHOT: Could not find artifact org.geotools.jdbc:gt-jdbc-h2gis:jar:29-SNAPSHOT in osgeo-snapshots (https://repo.osgeo.org/repository/snapshot/) -> [Help 1]

ebocher commented 1 year ago

I used a local compiled version. I don't known why the H2GIS extension is not published on https://repo.osgeo.org/repository/snapshot/ I will send a message to the list

ebocher commented 1 year ago

Hi @jericks The H2GIS workspace has been updated and it rocks now ! New methods are available on the H2GIS workspace to load, save, link file or table in a database. Added also some unit tests There is still a bug when I try to draw a linked shapefile. It seems related to the StreamingRenderer but the layer is correctly rendered. The test is currently disabled (drawLinkedShapeFile()). Feel free to test and comments this PR Erwan

jericks commented 1 year ago

There are a couple of failing tests:

2023-01-20T18:40:49.1237190Z [ERROR] Errors: 2023-01-20T18:40:49.1239427Z [ERROR] DBTilesTest.h2:78 » JdbcSQLSyntaxError Syntax error in SQL statement "CREATE TABLE IF NOT EXISTS metadata (name text, []value text);"; expected "identifier"; SQL statement: 2023-01-20T18:40:49.1240553Z CREATE TABLE IF NOT EXISTS metadata (name text, value text); [42001-214] 2023-01-20T18:40:49.1243425Z [ERROR] DBTilesTest.h2DataSource:91 » JdbcSQLSyntaxError Syntax error in SQL statement "CREATE TABLE IF NOT EXISTS metadata (name text, []value text);"; expected "identifier"; SQL statement: 2023-01-20T18:40:49.1244135Z CREATE TABLE IF NOT EXISTS metadata (name text, value text); [42001-214] 2023-01-20T18:40:49.1244977Z [ERROR] DBTilesTest.h2Metadata:101 » JdbcSQLSyntaxError Syntax error in SQL statement "CREATE TABLE IF NOT EXISTS metadata (name text, [*]value text);"; expected "identifier"; SQL statement: 2023-01-20T18:40:49.1245904Z CREATE TABLE IF NOT EXISTS metadata (name text, value text); [42001-214] 2023-01-20T18:40:49.1246438Z [ERROR] FormatTest.getFormat:29 » NullPointer Cannot invoke method dispose() on null object 2023-01-20T18:40:49.1246944Z [ERROR] GraticuleTest.createLinesToH2:174 » IO Schema 'lines' does not exist. 2023-01-20T18:40:49.1247387Z [ERROR] LayerTest.cursorPaging:845 » IO Schema 'facilities' does not exist. 2023-01-20T18:40:49.1248211Z [ERROR] LayerTest.cursorSorting:730 » IO Schema 'facilities' does not exist. 2023-01-20T18:40:49.1248674Z [ERROR] NetCDFTest.getNames:24 » NullPointer Cannot invoke method dispose() on null object 2023-01-20T18:40:49.1249130Z [ERROR] NetCDFTest.read:16 » NullPointer Cannot invoke method dispose() on null object 2023-01-20T18:40:49.1249597Z [ERROR] WriterTest.testWriterWithH2:62->testWriter:33 » IO Schema 'points' does not exist. 2023-01-20T18:40:49.1250195Z [ERROR] DatabaseStyleRepositoryTest.h2:29->runDatabaseTest:49 » MissingProperty No such property: characterStream for class: java.lang.String 2023-01-20T18:40:49.1250684Z [ERROR] H2Test.add:58 » IO Schema 'counties' does not exist. 2023-01-20T18:40:49.1251051Z [ERROR] H2Test.create:45 » IO Schema 'widgets' does not exist. 2023-01-20T18:40:49.1251427Z [ERROR] H2Test.createView:91 » IO Schema 'states' does not exist. 2023-01-20T18:40:49.1251810Z [ERROR] H2Test.createView2:67 » IO Schema 'states' does not exist. 2023-01-20T18:40:49.1253857Z [ERROR] H2Test.getSql:148 » IO Schema 'widgets' does not exist. 2023-01-20T18:40:49.1254278Z [ERROR] H2Test.getWorkspaceFromMap:193 » IO Schema 'points' does not exist. 2023-01-20T18:40:49.1254721Z [ERROR] H2Test.getWorkspaceFromString:180 » IO Schema 'points' does not exist. 2023-01-20T18:40:49.1255120Z [ERROR] H2Test.indexes:118 » IO Schema 'widgets' does not exist. 2023-01-20T18:40:49.1255490Z [ERROR] H2Test.remove:22 » IO Schema 'widgets' does not exist. 2023-01-20T18:40:49.1255708Z [INFO] 2023-01-20T18:40:49.1255936Z [ERROR] Tests run: 1507, Failures: 0, Errors: 20, Skipped: 2

ebocher commented 1 year ago

Hi @jericks

There is several conflicts due to the fact that some modules of GT use a very old version of H2 database : 1.1.119. H2GIS uses the 2.1.214. As geoscript is not modularized, I don't see a solution to solve this issue. H2GIS should be put in a specific container isolated from GT modules that use another version of h2. Best regards