incubator-baremaps
incubator-baremaps copied to clipboard
CGAlgorithmsDD::orientationIndex encountered NaN/Inf numbers
Building the basemap with the the following osm pbf, produces the error below:
Config
{
"osmPbfUrl": "https://download.geofabrik.de/europe/france/ile-de-france-latest.osm.pbf",
}
Stacktrace
[INFO ] 2023-10-28 14:41:49.168 [pool-2-thread-8] WorkflowExecutor - Executing task ExecuteSql[database=jdbc:postgresql://localhost:5432/baremaps?&user=bertil, file=layers/ocean/prepare.sql, parallel=false] of step openstreetmap-ocean
[INFO ] 2023-10-28 14:42:04.928 [pool-2-thread-8] WorkflowExecutor - Executing task ExecuteSql[database=jdbc:postgresql://localhost:5432/baremaps?&user=bertil, file=layers/ocean/index.sql, parallel=false] of step openstreetmap-ocean
java.util.concurrent.ExecutionException: org.apache.baremaps.workflow.WorkflowException: org.apache.baremaps.workflow.WorkflowException: org.postgresql.util.PSQLException: ERROR: GEOSTopologyPreserveSimplify: IllegalArgumentException: CGAlgorithmsDD::orientationIndex encountered NaN/Inf numbers
Where: parallel worker
at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073)
at org.apache.baremaps.cli.workflow.Execute.call(Execute.java:53)
at org.apache.baremaps.cli.workflow.Execute.call(Execute.java:34)
at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
at picocli.CommandLine.access$1500(CommandLine.java:148)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
at picocli.CommandLine.execute(CommandLine.java:2170)
at org.apache.baremaps.cli.Baremaps.main(Baremaps.java:66)
Caused by: org.apache.baremaps.workflow.WorkflowException: org.apache.baremaps.workflow.WorkflowException: org.postgresql.util.PSQLException: ERROR: GEOSTopologyPreserveSimplify: IllegalArgumentException: CGAlgorithmsDD::orientationIndex encountered NaN/Inf numbers
Where: parallel worker
at org.apache.baremaps.workflow.WorkflowExecutor.lambda$createFutureStep$3(WorkflowExecutor.java:167)
at java.base/java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:787)
at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1623)
Caused by: org.apache.baremaps.workflow.WorkflowException: org.postgresql.util.PSQLException: ERROR: GEOSTopologyPreserveSimplify: IllegalArgumentException: CGAlgorithmsDD::orientationIndex encountered NaN/Inf numbers
Where: parallel worker
at org.apache.baremaps.workflow.tasks.ExecuteSql.lambda$execute$0(ExecuteSql.java:46)
at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1006)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
at org.apache.baremaps.workflow.tasks.ExecuteSql.execute(ExecuteSql.java:39)
at org.apache.baremaps.workflow.WorkflowExecutor.lambda$createFutureStep$3(WorkflowExecutor.java:162)
... 5 more
Caused by: org.postgresql.util.PSQLException: ERROR: GEOSTopologyPreserveSimplify: IllegalArgumentException: CGAlgorithmsDD::orientationIndex encountered NaN/Inf numbers
Where: parallel worker
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2713)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2401)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:368)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:498)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:415)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:335)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:321)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:297)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:292)
at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:94)
at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
at org.apache.baremaps.workflow.tasks.ExecuteSql.lambda$execute$0(ExecuteSql.java:44)
... 9 more
Is a specific PostGIS version required?
Edit: Running it again, crashes again. Probably an issue with the data that is not handled gracefully.
@louwers Thanks a lot for reporting this, I'm currently not able to reproduce the issue. I tried several files from geofabrick without getting this exception.
I currently use the following docker image for postgis on the mac (kartoza/postgis:15-3.3). Could you provide some information about your postgis setup?
I'm using PostgreSQL 16 with PostGIS 3.4. I'm using https://postgresapp.com/ on macOS, you might want to try that (no Docker overhead).
It happens for the Switzerland data as well as the the Netherlands data (did not try other downloads).
Great, I have now been able to reproduce the error. It looks like st_simplifypreservetopology is causing this issue. A quick workaround was to replace these calls with st_simplify, but I will try to find for a better alternative.
The problem seems related to the version of geos used in PostgresApp (3.12.1) and specific to the use of st_simplifypreservetopology.
https://github.com/PostgresApp/PostgresApp/blob/bb7118f1b17224f0efd8cf094e20be3da812f88b/src-16/makefile#L24
The kartoza/postgis:16-3.4 docker image uses an older version of geos (3.11.1-CAPI-1.17.1). I will try to compile PostgressApp with geos 3.11.1 to confirm this. Only a few people seems to have encountered this problem yet, but I guess that it will become pervasive as people start building against the latest version of geos.