From ac863089e1bca1f23f67a46346e47de6b3d9ee37 Mon Sep 17 00:00:00 2001 From: Bertil Chapuis Date: Mon, 13 Nov 2023 16:54:52 +0100 Subject: [PATCH] Add replication url to task --- .../baremaps/workflow/tasks/UpdateOsmDatabase.java | 11 ++++++----- basemap/update.js | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java index 5e0707e6e..d87ff355d 100644 --- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java +++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java @@ -49,7 +49,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public record UpdateOsmDatabase(Object database, Integer databaseSrid) implements Task { +public record UpdateOsmDatabase(Object database, Integer databaseSrid, String replicationUrl) implements Task { private static final Logger logger = LoggerFactory.getLogger(UpdateOsmDatabase.class); @@ -69,21 +69,22 @@ public void execute(WorkflowContext context) throws Exception { nodeRepository, wayRepository, relationRepository, - databaseSrid); + databaseSrid, + replicationUrl); } public static void execute(DataMap coordinateMap, DataMap> referenceMap, HeaderRepository headerRepository, Repository nodeRepository, Repository wayRepository, Repository relationRepository, - int srid) throws Exception { + Integer databaseSrid, + String replicationUrl) throws Exception { var header = headerRepository.selectLatest(); - var replicationUrl = header.getReplicationUrl(); var sequenceNumber = header.getReplicationSequenceNumber() + 1; var createGeometry = new EntityGeometryBuilder(coordinateMap, referenceMap); - var reprojectGeometry = new EntityProjectionTransformer(4326, srid); + var reprojectGeometry = new EntityProjectionTransformer(4326, databaseSrid); var prepareGeometries = new ChangeEntitiesHandler(createGeometry.andThen(reprojectGeometry)); var prepareChange = consumeThenReturn(prepareGeometries); var importChange = new ChangeImporter(nodeRepository, wayRepository, relationRepository); diff --git a/basemap/update.js b/basemap/update.js index dff0b4490..ad38deae0 100644 --- a/basemap/update.js +++ b/basemap/update.js @@ -24,6 +24,7 @@ export default { "tasks": [ { "type": "UpdateOsmDatabase", + "replicationUrl": "https://planet.osm.org/replication/hour/", "database": config.database, "databaseSrid": 3857, },