This is an automated email from the ASF dual-hosted git repository. bchapuis pushed a commit to branch 590-flatgeobuf in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git
commit 9fdee1bb289ff6b5f31342cdb38c8af4bfeafa0b Author: Bertil Chapuis <[email protected]> AuthorDate: Tue Feb 28 13:05:43 2023 +0100 Fix task name --- .../storage/postgres/PostgresDatabase.java | 8 +++- .../java/org/apache/baremaps/workflow/Task.java | 2 +- examples/simplification/workflow.json | 52 +++++++++++++++++++++- 3 files changed, 57 insertions(+), 5 deletions(-) diff --git a/baremaps-core/src/main/java/org/apache/baremaps/storage/postgres/PostgresDatabase.java b/baremaps-core/src/main/java/org/apache/baremaps/storage/postgres/PostgresDatabase.java index ecfe2f96..62f9cf1e 100644 --- a/baremaps-core/src/main/java/org/apache/baremaps/storage/postgres/PostgresDatabase.java +++ b/baremaps-core/src/main/java/org/apache/baremaps/storage/postgres/PostgresDatabase.java @@ -29,10 +29,13 @@ import org.apache.baremaps.dataframe.*; import org.locationtech.jts.geom.*; import org.postgresql.PGConnection; import org.postgresql.copy.PGCopyOutputStream; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class PostgresDatabase implements DataStore { - // TODO: Instantiate with Map.of() + private static final Logger logger = LoggerFactory.getLogger(PostgresDatabase.class); + private static Map<Class, String> typeToName = Map.ofEntries( Map.entry(String.class, "varchar"), Map.entry(Short.class, "int2"), @@ -54,7 +57,6 @@ public class PostgresDatabase implements DataStore { Map.entry(LocalTime.class, "time"), Map.entry(LocalDateTime.class, "timestamp")); - // TODO: Instantiate with Map.of() private static Map<Class, BaseValueHandler> typeToHandler = Map.ofEntries( Map.entry(String.class, new StringValueHandler()), Map.entry(Short.class, new ShortValueHandler()), @@ -107,12 +109,14 @@ public class PostgresDatabase implements DataStore { // Drop the table if it exists var dropQuery = dropTable(schema); + logger.info(dropQuery); try (var dropStatement = connection.prepareStatement(dropQuery)) { dropStatement.execute(); } // Create the table var createQuery = createTable(schema); + logger.info(createQuery); try (var createStatement = connection.prepareStatement(createQuery)) { createStatement.execute(); } diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/Task.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/Task.java index b87fa347..7a5c919f 100644 --- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/Task.java +++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/Task.java @@ -40,7 +40,7 @@ import org.apache.baremaps.workflow.tasks.*; @JsonSubTypes.Type(value = UpdateOpenStreetMap.class, name = "UpdateOpenStreetMap"), @JsonSubTypes.Type(value = CreateGeonamesIndex.class, name = "CreateGeonamesIndex"), @JsonSubTypes.Type(value = CreateEntityCollection.class, name = "CreateEntityCollection"), - @JsonSubTypes.Type(value = TransformEntityCollection.class, name = "SimplifyEntityCollection"), + @JsonSubTypes.Type(value = TransformEntityCollection.class, name = "TransformEntityCollection"), @JsonSubTypes.Type(value = CreateIplocIndex.class, name = "CreateIplocIndex")}) public interface Task { diff --git a/examples/simplification/workflow.json b/examples/simplification/workflow.json index f82fdffe..8130d2ec 100644 --- a/examples/simplification/workflow.json +++ b/examples/simplification/workflow.json @@ -1,12 +1,38 @@ { "steps": [ { - "id": "simplify", + "id": "download", + "needs": [], + "tasks": [ + { + "type": "DownloadUrl", + "url": "https://download.geofabrik.de/europe/liechtenstein-latest.osm.pbf", + "path": "liechtenstein-latest.osm.pbf" + } + ] + }, + { + "id": "import", + "needs": [ + "download" + ], + "tasks": [ + { + "type": "CreateEntityCollection", + "file": "liechtenstein-latest.osm.pbf", + "collection": "collection", + "srid": 3857 + } + ] + }, + { + "id": "transform", "needs": [ + "import" ], "tasks": [ { - "type": "SimplifyEntityCollection", + "type": "TransformEntityCollection", "collection": "collection", "database": "jdbc:postgresql://localhost:5432/baremaps?&user=baremaps&password=baremaps", "recipe": { @@ -14,6 +40,28 @@ "filter": ["has", "building"], "operation": "union" } + }, + { + "type": "TransformEntityCollection", + "collection": "collection", + "database": "jdbc:postgresql://localhost:5432/baremaps?&user=baremaps&password=baremaps", + "recipe": { + "name": "landuse", + "filter": ["has", "landuse"], + "groupBy": ["landuse"], + "operation": "union" + } + }, + { + "type": "TransformEntityCollection", + "collection": "collection", + "database": "jdbc:postgresql://localhost:5432/baremaps?&user=baremaps&password=baremaps", + "recipe": { + "name": "natural", + "filter": ["has", "natural"], + "groupBy": ["natural"], + "operation": "union" + } } ] }
