This is an automated email from the ASF dual-hosted git repository. bchapuis pushed a commit to branch remove-test-data in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git
commit bf518e886a5b4c77f5ed38c28377a6f11de81c48 Author: Bertil Chapuis <[email protected]> AuthorDate: Tue Mar 5 11:20:30 2024 +0100 Replace osm dataset by sample dataset --- .../function/EntityGeometryBuilder.java | 6 +- .../function/NodeGeometryBuilder.java | 12 +- .../function/RelationMultiPolygonBuilder.java | 31 +-- .../openstreetmap/function/WayGeometryBuilder.java | 67 +++--- .../repository/ChangeElementsImporter.java | 85 +++++++ .../openstreetmap/xml/XmlChangeSpliterator.java | 8 +- .../baremaps/workflow/tasks/UpdateOsmDatabase.java | 39 ++- .../apache/baremaps/geocoderosm/OSMIndexTest.java | 4 +- .../baremaps/openstreetmap/OpenStreetMapTest.java | 43 ++-- .../baremaps/testing/GeometryAssertions.java | 50 ++++ .../org/apache/baremaps/testing/OsmSample.java | 263 +++++++++++++++++++++ .../org/apache/baremaps/testing/TestFiles.java | 14 -- .../tasks/ImportUpdateLiechtensteinTest.java | 99 -------- .../workflow/tasks/ImportUpdateSampleTest.java | 121 ++++++++++ .../resources/liechtenstein/000/002/435.osc.gz | Bin 46600 -> 0 bytes .../resources/liechtenstein/000/002/435.state.txt | 3 - .../resources/liechtenstein/000/002/436.osc.gz | Bin 12625 -> 0 bytes .../resources/liechtenstein/000/002/436.state.txt | 3 - .../resources/liechtenstein/000/002/437.osc.gz | Bin 9059 -> 0 bytes .../resources/liechtenstein/000/002/437.state.txt | 3 - .../resources/liechtenstein/liechtenstein.osm.pbf | Bin 2344930 -> 0 bytes .../src/test/resources/monaco/000/003/047.osc.gz | Bin 107 -> 0 bytes .../test/resources/monaco/000/003/047.state.txt | 3 - .../src/test/resources/monaco/000/003/048.osc.gz | Bin 1237 -> 0 bytes .../test/resources/monaco/000/003/048.state.txt | 3 - .../src/test/resources/monaco/000/003/049.osc.gz | Bin 107 -> 0 bytes .../test/resources/monaco/000/003/049.state.txt | 3 - .../src/test/resources/monaco/000/003/050.osc.gz | Bin 705 -> 0 bytes .../test/resources/monaco/000/003/050.state.txt | 3 - .../src/test/resources/monaco/000/003/051.osc.gz | Bin 4171 -> 0 bytes .../test/resources/monaco/000/003/051.state.txt | 3 - .../src/test/resources/monaco/000/003/052.osc.gz | Bin 21299 -> 0 bytes .../test/resources/monaco/000/003/052.state.txt | 3 - .../src/test/resources/monaco/000/003/053.osc.gz | Bin 107 -> 0 bytes .../test/resources/monaco/000/003/053.state.txt | 3 - .../src/test/resources/monaco/000/003/054.osc.gz | Bin 4169 -> 0 bytes .../test/resources/monaco/000/003/054.state.txt | 3 - .../src/test/resources/monaco/000/003/055.osc.gz | Bin 107 -> 0 bytes .../test/resources/monaco/000/003/055.state.txt | 3 - .../src/test/resources/monaco/000/003/056.osc.gz | Bin 107 -> 0 bytes .../test/resources/monaco/000/003/056.state.txt | 3 - .../src/test/resources/monaco/000/003/057.osc.gz | Bin 107 -> 0 bytes .../test/resources/monaco/000/003/057.state.txt | 3 - .../src/test/resources/monaco/000/003/058.osc.gz | Bin 330 -> 0 bytes .../test/resources/monaco/000/003/058.state.txt | 3 - .../src/test/resources/monaco/000/003/059.osc.gz | Bin 107 -> 0 bytes .../test/resources/monaco/000/003/059.state.txt | 3 - .../src/test/resources/monaco/000/003/060.osc.gz | Bin 13487 -> 0 bytes .../test/resources/monaco/000/003/060.state.txt | 3 - .../src/test/resources/monaco/000/003/061.osc.gz | Bin 107 -> 0 bytes .../test/resources/monaco/000/003/061.state.txt | 3 - .../src/test/resources/monaco/000/003/062.osc.gz | Bin 107 -> 0 bytes .../test/resources/monaco/000/003/062.state.txt | 3 - .../src/test/resources/monaco/000/003/063.osc.gz | Bin 313 -> 0 bytes .../test/resources/monaco/000/003/063.state.txt | 3 - .../src/test/resources/monaco/000/003/064.osc.gz | Bin 107 -> 0 bytes .../test/resources/monaco/000/003/064.state.txt | 3 - .../src/test/resources/monaco/000/003/065.osc.gz | Bin 13062 -> 0 bytes .../test/resources/monaco/000/003/065.state.txt | 3 - .../src/test/resources/monaco/000/003/066.osc.gz | Bin 368 -> 0 bytes .../test/resources/monaco/000/003/066.state.txt | 3 - .../src/test/resources/monaco/000/003/067.osc.gz | Bin 107 -> 0 bytes .../test/resources/monaco/000/003/067.state.txt | 3 - .../src/test/resources/monaco/000/003/068.osc.gz | Bin 4178 -> 0 bytes .../test/resources/monaco/000/003/068.state.txt | 3 - .../src/test/resources/monaco/000/003/069.osc.gz | Bin 107 -> 0 bytes .../test/resources/monaco/000/003/069.state.txt | 3 - .../src/test/resources/monaco/000/003/070.osc.gz | Bin 107 -> 0 bytes .../test/resources/monaco/000/003/070.state.txt | 3 - .../src/test/resources/monaco/000/003/071.osc.gz | Bin 107 -> 0 bytes .../test/resources/monaco/000/003/071.state.txt | 3 - .../src/test/resources/monaco/000/003/072.osc.gz | Bin 21325 -> 0 bytes .../test/resources/monaco/000/003/072.state.txt | 3 - .../src/test/resources/monaco/000/003/073.osc.gz | Bin 107 -> 0 bytes .../test/resources/monaco/000/003/073.state.txt | 3 - .../src/test/resources/monaco/000/003/074.osc.gz | Bin 107 -> 0 bytes .../test/resources/monaco/000/003/074.state.txt | 3 - .../src/test/resources/monaco/000/003/075.osc.gz | Bin 107 -> 0 bytes .../test/resources/monaco/000/003/075.state.txt | 3 - .../src/test/resources/monaco/000/003/076.osc.gz | Bin 1800 -> 0 bytes .../test/resources/monaco/000/003/076.state.txt | 3 - .../test/resources/monaco/monaco-210801.osm.pbf | Bin 456812 -> 0 bytes .../src/test/resources/monaco/monaco-state.txt | 3 - .../src/test/resources/monaco/monaco.osc.gz | Bin 33757 -> 0 bytes .../src/test/resources/monaco/monaco.osm.bz2 | Bin 588864 -> 0 bytes .../src/test/resources/monaco/monaco.osm.pbf | Bin 428872 -> 0 bytes baremaps-core/src/test/resources/monaco/state.txt | 3 - .../test/resources/osm-sample/000/000/002.osc.gz | Bin 0 -> 1126 bytes .../test/resources/osm-sample/000/000/002.osc.xml | 122 ++++++++++ .../resources/osm-sample/000/000/002.state.txt | 2 + .../test/resources/osm-sample/000/000/003.osc.gz | Bin 0 -> 1223 bytes .../test/resources/osm-sample/000/000/003.osc.xml | 136 +++++++++++ .../resources/osm-sample/000/000/003.state.txt | 2 + .../test/resources/osm-sample/000/000/004.osc.gz | Bin 0 -> 650 bytes .../test/resources/osm-sample/000/000/004.osc.xml | 26 ++ .../resources/osm-sample/000/000/004.state.txt | 2 + .../src/test/resources/osm-sample/build.sh | 9 + .../src/test/resources/osm-sample/sample.osm.pbf | Bin 0 -> 1670 bytes .../{samples => osm-sample}/sample.osm.xml | 140 +++++------ .../src/test/resources/osm-sample/state.txt | 2 + .../src/test/resources/samples/sample.osc.xml | 191 --------------- .../src/test/resources/samples/sample.osm.pbf | Bin 1654 -> 0 bytes 102 files changed, 1004 insertions(+), 575 deletions(-) diff --git a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/EntityGeometryBuilder.java b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/EntityGeometryBuilder.java index 740d45ff..093d6efb 100644 --- a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/EntityGeometryBuilder.java +++ b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/EntityGeometryBuilder.java @@ -28,9 +28,9 @@ import org.locationtech.jts.geom.*; /** A consumer that builds and sets the geometry of OpenStreetMap entities via side effects. */ public class EntityGeometryBuilder implements Consumer<Entity> { - private final Consumer<Node> nodeGeometryBuilder; - private final Consumer<Way> wayGeometryBuilder; - private final Consumer<Relation> relationMultiPolygonBuilder; + private final Consumer<Entity> nodeGeometryBuilder; + private final Consumer<Entity> wayGeometryBuilder; + private final Consumer<Entity> relationMultiPolygonBuilder; /** * Constructs a consumer that uses the provided caches to create and set geometries. diff --git a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/NodeGeometryBuilder.java b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/NodeGeometryBuilder.java index 2859471b..f1c5b947 100644 --- a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/NodeGeometryBuilder.java +++ b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/NodeGeometryBuilder.java @@ -20,18 +20,22 @@ package org.apache.baremaps.openstreetmap.function; import static org.apache.baremaps.utils.GeometryUtils.GEOMETRY_FACTORY_WGS84; import java.util.function.Consumer; +import org.apache.baremaps.openstreetmap.model.Entity; import org.apache.baremaps.openstreetmap.model.Node; import org.locationtech.jts.geom.*; /** * A consumer that builds and sets a node geometry via side effects. */ -public class NodeGeometryBuilder implements Consumer<Node> { +public class NodeGeometryBuilder implements Consumer<Entity> { /** {@inheritDoc} */ @Override - public void accept(Node node) { - Point point = GEOMETRY_FACTORY_WGS84.createPoint(new Coordinate(node.getLon(), node.getLat())); - node.setGeometry(point); + public void accept(Entity entity) { + if (entity instanceof Node node) { + Point point = + GEOMETRY_FACTORY_WGS84.createPoint(new Coordinate(node.getLon(), node.getLat())); + node.setGeometry(point); + } } } diff --git a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/RelationMultiPolygonBuilder.java b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/RelationMultiPolygonBuilder.java index e80ff665..a530a671 100644 --- a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/RelationMultiPolygonBuilder.java +++ b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/RelationMultiPolygonBuilder.java @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; import org.apache.baremaps.database.collection.DataMap; +import org.apache.baremaps.openstreetmap.model.Entity; import org.apache.baremaps.openstreetmap.model.Member; import org.apache.baremaps.openstreetmap.model.Member.MemberType; import org.apache.baremaps.openstreetmap.model.Relation; @@ -37,7 +38,7 @@ import org.slf4j.LoggerFactory; /** * A consumer that builds and sets a relation geometry via side effects. */ -public class RelationMultiPolygonBuilder implements Consumer<Relation> { +public class RelationMultiPolygonBuilder implements Consumer<Entity> { private static final Logger logger = LoggerFactory.getLogger(RelationMultiPolygonBuilder.class); @@ -59,22 +60,24 @@ public class RelationMultiPolygonBuilder implements Consumer<Relation> { /** {@inheritDoc} */ @Override - public void accept(Relation relation) { - try { - var start = System.currentTimeMillis(); + public void accept(Entity entity) { + if (entity instanceof Relation relation) { + try { + var start = System.currentTimeMillis(); - buildMultiPolygon(relation); + buildMultiPolygon(relation); - var end = System.currentTimeMillis(); - var duration = end - start; - if (duration > 60 * 1000) { - logger.debug("Relation #{} processed in {} ms", relation.getId(), duration); - } + var end = System.currentTimeMillis(); + var duration = end - start; + if (duration > 60 * 1000) { + logger.debug("Relation #{} processed in {} ms", relation.getId(), duration); + } - } catch (Exception e) { - logger.debug("Unable to build the geometry for relation #" + relation.getId(), e); - var emptyMultiPolygon = GEOMETRY_FACTORY_WGS84.createMultiPolygon(); - relation.setGeometry(emptyMultiPolygon); + } catch (Exception e) { + logger.debug("Unable to build the geometry for relation #" + relation.getId(), e); + var emptyMultiPolygon = GEOMETRY_FACTORY_WGS84.createMultiPolygon(); + relation.setGeometry(emptyMultiPolygon); + } } } diff --git a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/WayGeometryBuilder.java b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/WayGeometryBuilder.java index a3d5e740..b6b74ccc 100644 --- a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/WayGeometryBuilder.java +++ b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/WayGeometryBuilder.java @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; import org.apache.baremaps.database.collection.DataMap; +import org.apache.baremaps.openstreetmap.model.Entity; import org.apache.baremaps.openstreetmap.model.Way; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.LineString; @@ -34,7 +35,7 @@ import org.slf4j.LoggerFactory; /** * A consumer that builds and sets a way geometry via side effects. */ -public class WayGeometryBuilder implements Consumer<Way> { +public class WayGeometryBuilder implements Consumer<Entity> { private static final Logger logger = LoggerFactory.getLogger(WayGeometryBuilder.class); @@ -51,44 +52,46 @@ public class WayGeometryBuilder implements Consumer<Way> { /** {@inheritDoc} */ @Override - public void accept(Way way) { - try { - // Build the coordinate list and remove duplicates. - List<Coordinate> list = new ArrayList<>(); - Coordinate previous = null; - for (Long id : way.getNodes()) { - Coordinate coordinate = coordinateMap.get(id); - if (coordinate != null && !coordinate.equals(previous)) { - list.add(coordinate); - previous = coordinate; + public void accept(Entity entity) { + if (entity instanceof Way way) { + try { + // Build the coordinate list and remove duplicates. + List<Coordinate> list = new ArrayList<>(); + Coordinate previous = null; + for (Long id : way.getNodes()) { + Coordinate coordinate = coordinateMap.get(id); + if (coordinate != null && !coordinate.equals(previous)) { + list.add(coordinate); + previous = coordinate; + } } - } - Coordinate[] array = list.toArray(new Coordinate[0]); - LineString line = GEOMETRY_FACTORY_WGS84.createLineString(array); + Coordinate[] array = list.toArray(new Coordinate[0]); + LineString line = GEOMETRY_FACTORY_WGS84.createLineString(array); - if (!line.isEmpty()) { - // Ways can be open or closed depending on the geometry or the tags: - // https://wiki.openstreetmap.org/wiki/Way - if (!line.isClosed() - || way.getTags().containsKey("railway") - || way.getTags().containsKey("highway") - || way.getTags().containsKey("barrier")) { - way.setGeometry(line); - } else { - Polygon polygon = GEOMETRY_FACTORY_WGS84.createPolygon(line.getCoordinates()); - if (polygon.isValid()) { - way.setGeometry(polygon); + if (!line.isEmpty()) { + // Ways can be open or closed depending on the geometry or the tags: + // https://wiki.openstreetmap.org/wiki/Way + if (!line.isClosed() + || way.getTags().containsKey("railway") + || way.getTags().containsKey("highway") + || way.getTags().containsKey("barrier")) { + way.setGeometry(line); } else { - var geometryFixer = new GeometryFixer(polygon); - var fixedGeometry = geometryFixer.getResult(); - way.setGeometry(fixedGeometry); + Polygon polygon = GEOMETRY_FACTORY_WGS84.createPolygon(line.getCoordinates()); + if (polygon.isValid()) { + way.setGeometry(polygon); + } else { + var geometryFixer = new GeometryFixer(polygon); + var fixedGeometry = geometryFixer.getResult(); + way.setGeometry(fixedGeometry); + } } } + } catch (Exception e) { + logger.debug("Unable to build the geometry for way #" + way.getId(), e); + way.setGeometry(GEOMETRY_FACTORY_WGS84.createEmpty(0)); } - } catch (Exception e) { - logger.debug("Unable to build the geometry for way #" + way.getId(), e); - way.setGeometry(GEOMETRY_FACTORY_WGS84.createEmpty(0)); } } } diff --git a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/repository/ChangeElementsImporter.java b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/repository/ChangeElementsImporter.java new file mode 100644 index 00000000..69ed524e --- /dev/null +++ b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/repository/ChangeElementsImporter.java @@ -0,0 +1,85 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to you under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.baremaps.openstreetmap.repository; + + +import java.util.function.Consumer; +import org.apache.baremaps.openstreetmap.model.Change; +import org.apache.baremaps.openstreetmap.model.Element; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** A consumer for importing change nodes in a database. */ +public class ChangeElementsImporter<T extends Element> implements Consumer<Change> { + + private static final Logger logger = LoggerFactory.getLogger(ChangeElementsImporter.class); + + private final Class<T> type; + + private final Repository<Long, T> nodeRepository; + + /** + * Constructs a {@code ChangeNodesImporter}. + * + * @param nodeRepository the node repository + */ + public ChangeElementsImporter( + Class<T> type, + Repository<Long, T> nodeRepository) { + this.type = type; + this.nodeRepository = nodeRepository; + } + + /** {@inheritDoc} */ + @Override + public void accept(Change change) { + switch (change.getType()) { + case CREATE, MODIFY -> put(change); + case DELETE -> delete(change); + } + } + + private void put(Change change) { + var nodes = change.getEntities().stream() + .filter(type::isInstance) + .map(type::cast) + .toList(); + if (!nodes.isEmpty()) { + try { + nodeRepository.put(nodes); + } catch (RepositoryException e) { + logger.error("Failed to save nodes", e); + } + } + } + + private void delete(Change change) { + var nodes = change.getEntities().stream() + .filter(type::isInstance) + .map(type::cast) + .map(Element::getId) + .toList(); + if (!nodes.isEmpty()) { + try { + nodeRepository.delete(nodes); + } catch (RepositoryException e) { + logger.error("Failed to delete nodes", e); + } + } + } +} diff --git a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/xml/XmlChangeSpliterator.java b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/xml/XmlChangeSpliterator.java index 9830d5ba..66d7fcec 100644 --- a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/xml/XmlChangeSpliterator.java +++ b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/xml/XmlChangeSpliterator.java @@ -155,8 +155,10 @@ public class XmlChangeSpliterator implements Spliterator<Change> { private Node readNode() throws XMLStreamException { long id = Long.parseLong(reader.getAttributeValue(null, ATTRIBUTE_NAME_ID)); Info info = readInfo(); - double lat = Double.parseDouble(reader.getAttributeValue(null, ATTRIBUTE_NAME_LATITUDE)); - double lon = Double.parseDouble(reader.getAttributeValue(null, ATTRIBUTE_NAME_LONGITUDE)); + var latAttribute = reader.getAttributeValue(null, ATTRIBUTE_NAME_LATITUDE); + var lonAttribute = reader.getAttributeValue(null, ATTRIBUTE_NAME_LONGITUDE); + var latValue = latAttribute != null ? Double.parseDouble(latAttribute) : Double.NaN; + var lonValue = lonAttribute != null ? Double.parseDouble(lonAttribute) : Double.NaN; // read the content of the node Map<String, Object> tags = new HashMap<>(); @@ -172,7 +174,7 @@ public class XmlChangeSpliterator implements Spliterator<Change> { } } - return new Node(id, info, tags, lon, lat); + return new Node(id, info, tags, lonValue, latValue); } private Way readWay() throws XMLStreamException { 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 6bc87e0f..817efa6d 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 @@ -17,16 +17,12 @@ package org.apache.baremaps.workflow.tasks; -import static org.apache.baremaps.stream.ConsumerUtils.consumeThenReturn; - import java.io.BufferedInputStream; import java.util.List; import java.util.StringJoiner; import java.util.zip.GZIPInputStream; import org.apache.baremaps.database.collection.DataMap; -import org.apache.baremaps.openstreetmap.function.ChangeEntitiesHandler; -import org.apache.baremaps.openstreetmap.function.EntityGeometryBuilder; -import org.apache.baremaps.openstreetmap.function.EntityProjectionTransformer; +import org.apache.baremaps.openstreetmap.function.*; import org.apache.baremaps.openstreetmap.model.Header; import org.apache.baremaps.openstreetmap.model.Node; import org.apache.baremaps.openstreetmap.model.Relation; @@ -38,7 +34,6 @@ import org.apache.baremaps.openstreetmap.postgres.PostgresReferenceMap; import org.apache.baremaps.openstreetmap.postgres.PostgresRelationRepository; import org.apache.baremaps.openstreetmap.postgres.PostgresWayRepository; import org.apache.baremaps.openstreetmap.repository.*; -import org.apache.baremaps.openstreetmap.repository.PutChangeImporter; import org.apache.baremaps.openstreetmap.state.StateReader; import org.apache.baremaps.openstreetmap.xml.XmlChangeReader; import org.apache.baremaps.workflow.Task; @@ -146,14 +141,34 @@ public class UpdateOsmDatabase implements Task { logger.info("Updating the database with the changeset: {}", changeUrl); // Process the changeset and update the database - var createGeometry = new EntityGeometryBuilder(coordinateMap, referenceMap); - var reprojectGeometry = new EntityProjectionTransformer(4326, databaseSrid); - var prepareGeometries = new ChangeEntitiesHandler(createGeometry.andThen(reprojectGeometry)); - var prepareChange = consumeThenReturn(prepareGeometries); - var importChange = new PutChangeImporter(nodeRepository, wayRepository, relationRepository); + var buildNodeGeometry = new NodeGeometryBuilder(); + var reprojectNodeGeometry = new EntityProjectionTransformer(4326, databaseSrid); + var prepareNodeGeometry = + new ChangeEntitiesHandler(buildNodeGeometry.andThen(reprojectNodeGeometry)); + var importNodes = new ChangeElementsImporter<>(Node.class, nodeRepository); + + var buildWayGeometry = new WayGeometryBuilder(coordinateMap); + var reprojectWayGeometry = new EntityProjectionTransformer(4326, databaseSrid); + var prepareWayGeometry = + new ChangeEntitiesHandler(buildWayGeometry.andThen(reprojectWayGeometry)); + var importWays = new ChangeElementsImporter<>(Way.class, wayRepository); + + var buildRelationGeometry = new RelationMultiPolygonBuilder(coordinateMap, referenceMap); + var reprojectRelationGeometry = new EntityProjectionTransformer(4326, databaseSrid); + var prepareRelationGeometry = + new ChangeEntitiesHandler(buildRelationGeometry.andThen(reprojectRelationGeometry)); + var importRelations = new ChangeElementsImporter<>(Relation.class, relationRepository); + + var entityProcessor = prepareNodeGeometry + .andThen(importNodes) + .andThen(prepareWayGeometry) + .andThen(importWays) + .andThen(prepareRelationGeometry) + .andThen(importRelations); + try (var changeInputStream = new GZIPInputStream(new BufferedInputStream(changeUrl.openStream()))) { - new XmlChangeReader().stream(changeInputStream).map(prepareChange).forEach(importChange); + new XmlChangeReader().stream(changeInputStream).forEach(entityProcessor); } // Add the new header to the database diff --git a/baremaps-core/src/test/java/org/apache/baremaps/geocoderosm/OSMIndexTest.java b/baremaps-core/src/test/java/org/apache/baremaps/geocoderosm/OSMIndexTest.java index b085791a..6890e2fc 100644 --- a/baremaps-core/src/test/java/org/apache/baremaps/geocoderosm/OSMIndexTest.java +++ b/baremaps-core/src/test/java/org/apache/baremaps/geocoderosm/OSMIndexTest.java @@ -17,7 +17,7 @@ package org.apache.baremaps.geocoderosm; -import static org.apache.baremaps.testing.TestFiles.LIECHTENSTEIN_OSM_PBF; +import static org.apache.baremaps.testing.OsmSample.SAMPLE_OSM_PBF; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -62,7 +62,7 @@ public class OSMIndexTest { // Create the geonames index - var task = new CreateGeocoderOpenStreetMap(LIECHTENSTEIN_OSM_PBF, directory); + var task = new CreateGeocoderOpenStreetMap(SAMPLE_OSM_PBF, directory); task.execute(new WorkflowContext()); var dir = MMapDirectory.open(directory); var searcherManager = new SearcherManager(dir, new SearcherFactory()); diff --git a/baremaps-core/src/test/java/org/apache/baremaps/openstreetmap/OpenStreetMapTest.java b/baremaps-core/src/test/java/org/apache/baremaps/openstreetmap/OpenStreetMapTest.java index c8d57544..2a17d8ee 100644 --- a/baremaps-core/src/test/java/org/apache/baremaps/openstreetmap/OpenStreetMapTest.java +++ b/baremaps-core/src/test/java/org/apache/baremaps/openstreetmap/OpenStreetMapTest.java @@ -17,15 +17,7 @@ package org.apache.baremaps.openstreetmap; -import static org.apache.baremaps.testing.TestFiles.DATA_OSC_XML; -import static org.apache.baremaps.testing.TestFiles.DATA_OSM_PBF; -import static org.apache.baremaps.testing.TestFiles.DATA_OSM_XML; -import static org.apache.baremaps.testing.TestFiles.DENSE_NODES_OSM_PBF; -import static org.apache.baremaps.testing.TestFiles.MONACO_OSM_BZ2; -import static org.apache.baremaps.testing.TestFiles.MONACO_OSM_PBF; -import static org.apache.baremaps.testing.TestFiles.MONACO_STATE_TXT; -import static org.apache.baremaps.testing.TestFiles.RELATIONS_OSM_PBF; -import static org.apache.baremaps.testing.TestFiles.WAYS_OSM_PBF; +import static org.apache.baremaps.testing.TestFiles.*; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -48,7 +40,7 @@ import org.apache.baremaps.openstreetmap.pbf.PbfEntityReader; import org.apache.baremaps.openstreetmap.state.StateReader; import org.apache.baremaps.openstreetmap.xml.XmlChangeReader; import org.apache.baremaps.openstreetmap.xml.XmlEntityReader; -import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream; +import org.apache.baremaps.testing.OsmSample; import org.junit.jupiter.api.Test; class OpenStreetMapTest { @@ -121,28 +113,27 @@ class OpenStreetMapTest { } @Test - void monacoStateTxt() throws URISyntaxException, IOException { - try (InputStream inputStream = Files.newInputStream(MONACO_STATE_TXT)) { + void sampleStateTxt() throws URISyntaxException, IOException { + try (InputStream inputStream = Files.newInputStream(OsmSample.SAMPLE_STATE_TXT)) { State state = new StateReader().readState(inputStream); - assertEquals(2788, state.getSequenceNumber()); - assertEquals(LocalDateTime.parse("2020-11-10T21:42:03"), state.getTimestamp()); + assertEquals(1, state.getSequenceNumber()); + assertEquals(LocalDateTime.parse("2000-01-01T00:00:00"), state.getTimestamp()); } } @Test - void monacoOsmPbf() throws IOException, URISyntaxException { - try (InputStream inputStream = Files.newInputStream(MONACO_OSM_PBF)) { + void sampleOsmPbf() throws IOException, URISyntaxException { + try (InputStream inputStream = Files.newInputStream(OsmSample.SAMPLE_OSM_PBF)) { Stream<Entity> stream = new PbfEntityReader().stream(inputStream); - process(stream, 1, 1, 25002, 4018, 243); + process(stream, 1, 1, 27, 7, 2); } } @Test - void monacoOsmBz2() throws IOException, URISyntaxException { - try (InputStream inputStream = - new BZip2CompressorInputStream(Files.newInputStream(MONACO_OSM_BZ2))) { + void sampleOsmXml() throws IOException { + try (InputStream inputStream = Files.newInputStream(OsmSample.SAMPLE_OSM_XML)) { Stream<Entity> stream = new XmlEntityReader().stream(inputStream); - process(stream, 1, 1, 24951, 4015, 243); + process(stream, 1, 1, 27, 7, 2); } } @@ -156,14 +147,14 @@ class OpenStreetMapTest { stream.forEach(entity -> { if (entity instanceof Header header) { assertNotNull(header); - assertEquals("osmium/1.8.0", header.getWritingProgram()); + assertEquals("osmium/1.16.0", header.getWritingProgram()); headers.incrementAndGet(); } else if (entity instanceof Bound bound) { assertNotNull(bound); - assertEquals(43.75169, bound.getMaxLat(), 0.000001); - assertEquals(7.448637, bound.getMaxLon(), 0.000001); - assertEquals(43.72335, bound.getMinLat(), 0.000001); - assertEquals(7.409205, bound.getMinLon(), 0.000001); + assertEquals(0.0, bound.getMinLat(), 0.000001); + assertEquals(0.0, bound.getMinLon(), 0.000001); + assertEquals(20.0, bound.getMaxLat(), 0.000001); + assertEquals(20.0, bound.getMaxLon(), 0.000001); bounds.incrementAndGet(); } else if (entity instanceof Node node) { assertNotNull(node); diff --git a/baremaps-core/src/test/java/org/apache/baremaps/testing/GeometryAssertions.java b/baremaps-core/src/test/java/org/apache/baremaps/testing/GeometryAssertions.java new file mode 100644 index 00000000..4b9e2ed1 --- /dev/null +++ b/baremaps-core/src/test/java/org/apache/baremaps/testing/GeometryAssertions.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to you under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.baremaps.testing; + +import org.locationtech.jts.geom.Geometry; +import org.locationtech.jts.geom.PrecisionModel; +import org.locationtech.jts.precision.GeometryPrecisionReducer; + +public class GeometryAssertions { + + public static void assertGeometryEquals(Geometry expected, Geometry actual) { + if (expected == null && actual == null) { + return; + } + if (expected == null || actual == null) { + throw new AssertionError("Expected " + expected + " but was " + actual); + } + if (!expected.equalsExact(actual)) { + throw new AssertionError("Expected " + expected + " but was " + actual); + } + } + + public static void assertGeometryEquals(Geometry expected, Geometry actual, double tolerance) { + if (expected == null && actual == null) { + return; + } + if (expected == null || actual == null) { + throw new AssertionError("Expected " + expected + " but was " + actual); + } + PrecisionModel precisionModel = new PrecisionModel(tolerance); + GeometryPrecisionReducer reducer = new GeometryPrecisionReducer(precisionModel); + reducer.setPointwise(true); + assertGeometryEquals(reducer.reduce(expected), reducer.reduce(actual)); + } +} diff --git a/baremaps-core/src/test/java/org/apache/baremaps/testing/OsmSample.java b/baremaps-core/src/test/java/org/apache/baremaps/testing/OsmSample.java new file mode 100644 index 00000000..01402166 --- /dev/null +++ b/baremaps-core/src/test/java/org/apache/baremaps/testing/OsmSample.java @@ -0,0 +1,263 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to you under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.baremaps.testing; + +import java.nio.file.Path; +import org.locationtech.jts.geom.*; + +public class OsmSample { + + /* The paths of the sample directory and files */ + + public static final Path SAMPLE_DIR = TestFiles.resolve("osm-sample/"); + + public static final Path SAMPLE_STATE_TXT = TestFiles.resolve("osm-sample/state.txt"); + + public static final Path SAMPLE_OSM_XML = TestFiles.resolve("osm-sample/sample.osm.xml"); + + public static final Path SAMPLE_OSM_PBF = TestFiles.resolve("osm-sample/sample.osm.pbf"); + + public static final Path SAMPLE_OSC_XML_2 = TestFiles.resolve("osm-sample/000/000/002.osc.gz"); + + public static final Path SAMPLE_OSC_XML_3 = TestFiles.resolve("osm-sample/000/000/003.osc.gz"); + + public static final Path SAMPLE_OSC_XML_4 = TestFiles.resolve("osm-sample/000/000/004.osc.gz"); + + /* The geometries of the osm-sample/sample.osm.xml file */ + + private static final GeometryFactory GEOMETRY_FACTORY = new GeometryFactory(); + + // Node (point) + public static final Point NODE_POINT_1 = GEOMETRY_FACTORY.createPoint(new Coordinate(0.0, 0.0)); + + // Way (line) + public static final LineString WAY_LINESTRING_4 = + GEOMETRY_FACTORY.createLineString(new Coordinate[] { + new Coordinate(1.0, 1.0), + new Coordinate(2.0, 2.0) + }); + + // Way (polygon) + public static final Polygon WAY_POLYGON_9 = GEOMETRY_FACTORY.createPolygon(new Coordinate[] { + new Coordinate(2.0, 2.0), + new Coordinate(2.0, 3.0), + new Coordinate(3.0, 3.0), + new Coordinate(3.0, 2.0), + new Coordinate(2.0, 2.0) + }); + + // Relation (polygon with hole) + public static final MultiPolygon RELATION_MULTIPOLYGON_20 = GEOMETRY_FACTORY.createMultiPolygon( + new Polygon[] { + GEOMETRY_FACTORY.createPolygon( + GEOMETRY_FACTORY.createLinearRing(new Coordinate[] { + new Coordinate(3.0, 3.0), + new Coordinate(3.0, 4.0), + new Coordinate(4.0, 4.0), + new Coordinate(4.0, 3.0), + new Coordinate(3.0, 3.0) + }), + new LinearRing[] { + GEOMETRY_FACTORY.createLinearRing(new Coordinate[] { + new Coordinate(3.4, 3.4), + new Coordinate(3.6, 3.4), + new Coordinate(3.6, 3.6), + new Coordinate(3.4, 3.6), + new Coordinate(3.4, 3.4) + }) + }) + }); + + // Relation (polygon with island and hole) + public static final MultiPolygon RELATION_MULTIPOLYGON_36 = + GEOMETRY_FACTORY.createMultiPolygon(new Polygon[] { + GEOMETRY_FACTORY.createPolygon( + GEOMETRY_FACTORY.createLinearRing(new Coordinate[] { + new Coordinate(4.0, 4.0), + new Coordinate(4.0, 4.6), + new Coordinate(4.6, 4.6), + new Coordinate(4.6, 4.0), + new Coordinate(4.0, 4.0) + }), + new LinearRing[] { + GEOMETRY_FACTORY.createLinearRing(new Coordinate[] { + new Coordinate(4.2, 4.2), + new Coordinate(4.4, 4.2), + new Coordinate(4.4, 4.4), + new Coordinate(4.2, 4.4), + new Coordinate(4.2, 4.2) + }) + }), + GEOMETRY_FACTORY.createPolygon( + GEOMETRY_FACTORY.createLinearRing(new Coordinate[] { + new Coordinate(4.8, 4.8), + new Coordinate(4.8, 5.0), + new Coordinate(5.0, 5.0), + new Coordinate(5.0, 4.8), + new Coordinate(4.8, 4.8) + })) + }); + + /* The geometries of the osm-sample/000/000/002.osc.gz file */ + + // Node (point) + public static final Point NODE_POINT_37 = GEOMETRY_FACTORY.createPoint(new Coordinate(6.0, 6.0)); + + // Way (line) + public static final LineString WAY_LINESTRING_40 = + GEOMETRY_FACTORY.createLineString(new Coordinate[] { + new Coordinate(7.0, 7.0), + new Coordinate(8.0, 8.0) + }); + + // Way (polygon) + public static final Polygon WAY_POLYGON_45 = GEOMETRY_FACTORY.createPolygon(new Coordinate[] { + new Coordinate(8.0, 8.0), + new Coordinate(8.0, 9.0), + new Coordinate(9.0, 9.0), + new Coordinate(9.0, 8.0), + new Coordinate(8.0, 8.0) + }); + + // Relation (polygon with hole) + public static final MultiPolygon RELATION_MULTIPOLYGON_56 = GEOMETRY_FACTORY.createMultiPolygon( + new Polygon[] { + GEOMETRY_FACTORY.createPolygon( + GEOMETRY_FACTORY.createLinearRing(new Coordinate[] { + new Coordinate(9.0, 9.0), + new Coordinate(9.0, 10.0), + new Coordinate(10.0, 10.0), + new Coordinate(10.0, 9.0), + new Coordinate(9.0, 9.0) + }), + new LinearRing[] { + GEOMETRY_FACTORY.createLinearRing(new Coordinate[] { + new Coordinate(9.4, 9.4), + new Coordinate(9.6, 9.4), + new Coordinate(9.6, 9.6), + new Coordinate(9.4, 9.6), + new Coordinate(9.4, 9.4) + }) + }) + }); + + // Relation (polygon with island and hole) + public static final MultiPolygon RELATION_MULTIPOLYGON_72 = + GEOMETRY_FACTORY.createMultiPolygon(new Polygon[] { + GEOMETRY_FACTORY.createPolygon( + GEOMETRY_FACTORY.createLinearRing(new Coordinate[] { + new Coordinate(10.0, 10.0), + new Coordinate(10.0, 10.6), + new Coordinate(10.6, 10.6), + new Coordinate(10.6, 10.0), + new Coordinate(10.0, 10.0) + }), + new LinearRing[] { + GEOMETRY_FACTORY.createLinearRing(new Coordinate[] { + new Coordinate(10.2, 10.2), + new Coordinate(10.4, 10.2), + new Coordinate(10.4, 10.4), + new Coordinate(10.2, 10.4), + new Coordinate(10.2, 10.2) + }) + }), + GEOMETRY_FACTORY.createPolygon( + GEOMETRY_FACTORY.createLinearRing(new Coordinate[] { + new Coordinate(10.8, 10.8), + new Coordinate(10.8, 11.0), + new Coordinate(11.0, 11.0), + new Coordinate(11.0, 10.8), + new Coordinate(10.8, 10.8) + })) + }); + + /* The geometries of the osm-sample/000/000/003.osc.gz file */ + + // Node (point) + public static final Point NODE_POINT_1_MODIFIED = + GEOMETRY_FACTORY.createPoint(new Coordinate(0.5, 0.5)); + + // Way (line) + public static final LineString WAY_LINESTRING_4_MODIFIED = + GEOMETRY_FACTORY.createLineString(new Coordinate[] { + new Coordinate(1.2, 1.2), + new Coordinate(1.8, 1.8) + }); + + // Way (polygon) + public static final Polygon WAY_POLYGON_9_MODIFIED = + GEOMETRY_FACTORY.createPolygon(new Coordinate[] { + new Coordinate(2.1, 2.1), + new Coordinate(2.1, 2.9), + new Coordinate(2.9, 2.9), + new Coordinate(2.9, 2.1), + new Coordinate(2.1, 2.1) + }); + + // Relation (polygon with hole) + public static final MultiPolygon RELATION_MULTIPOLYGON_20_MODIFIED = + GEOMETRY_FACTORY.createMultiPolygon( + new Polygon[] { + GEOMETRY_FACTORY.createPolygon( + GEOMETRY_FACTORY.createLinearRing(new Coordinate[] { + new Coordinate(3.0, 3.0), + new Coordinate(3.0, 4.0), + new Coordinate(4.0, 4.0), + new Coordinate(4.0, 3.0), + new Coordinate(3.0, 3.0) + }), + new LinearRing[] { + GEOMETRY_FACTORY.createLinearRing(new Coordinate[] { + new Coordinate(3.5, 3.5), + new Coordinate(3.6, 3.5), + new Coordinate(3.6, 3.6), + new Coordinate(3.5, 3.6), + new Coordinate(3.5, 3.5) + }) + }) + }); + + public static final MultiPolygon RELATION_MULTIPOLYGON_36_MODIFIED = + GEOMETRY_FACTORY.createMultiPolygon(new Polygon[] { + GEOMETRY_FACTORY.createPolygon( + GEOMETRY_FACTORY.createLinearRing(new Coordinate[] { + new Coordinate(4.0, 4.0), + new Coordinate(4.0, 4.6), + new Coordinate(4.6, 4.6), + new Coordinate(4.6, 4.0), + new Coordinate(4.0, 4.0) + }), + new LinearRing[] { + GEOMETRY_FACTORY.createLinearRing(new Coordinate[] { + new Coordinate(4.2, 4.2), + new Coordinate(4.4, 4.2), + new Coordinate(4.4, 4.4), + new Coordinate(4.2, 4.4), + new Coordinate(4.2, 4.2) + }) + }), + GEOMETRY_FACTORY.createPolygon( + GEOMETRY_FACTORY.createLinearRing(new Coordinate[] { + new Coordinate(4.9, 4.9), + new Coordinate(4.9, 5.0), + new Coordinate(5.0, 5.0), + new Coordinate(5.0, 4.9), + new Coordinate(4.9, 4.9) + })) + }); +} diff --git a/baremaps-core/src/test/java/org/apache/baremaps/testing/TestFiles.java b/baremaps-core/src/test/java/org/apache/baremaps/testing/TestFiles.java index 58094cb1..ce05ad22 100644 --- a/baremaps-core/src/test/java/org/apache/baremaps/testing/TestFiles.java +++ b/baremaps-core/src/test/java/org/apache/baremaps/testing/TestFiles.java @@ -39,20 +39,6 @@ public class TestFiles { public static final Path RELATIONS_OSM_PBF = resolve("relations.osm.pbf"); - public static final Path LIECHTENSTEIN_DIR = resolve("liechtenstein"); - - public static final Path LIECHTENSTEIN_OSM_PBF = resolve("liechtenstein/liechtenstein.osm.pbf"); - - public static final Path MONACO_DIR = resolve("monaco"); - - public static final Path MONACO_OSC_GZ = resolve("monaco/monaco.osc.gz"); - - public static final Path MONACO_OSM_BZ2 = resolve("monaco/monaco.osm.bz2"); - - public static final Path MONACO_OSM_PBF = resolve("monaco/monaco.osm.pbf"); - - public static final Path MONACO_STATE_TXT = resolve("monaco/monaco-state.txt"); - public static final Path STYLE_JS = resolve("style.js"); public static final Path FILE_BZ2 = resolve("archives/file.bz2"); diff --git a/baremaps-core/src/test/java/org/apache/baremaps/workflow/tasks/ImportUpdateLiechtensteinTest.java b/baremaps-core/src/test/java/org/apache/baremaps/workflow/tasks/ImportUpdateLiechtensteinTest.java deleted file mode 100644 index a8d44aa4..00000000 --- a/baremaps-core/src/test/java/org/apache/baremaps/workflow/tasks/ImportUpdateLiechtensteinTest.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.baremaps.workflow.tasks; - -import static org.apache.baremaps.testing.TestFiles.LIECHTENSTEIN_DIR; -import static org.apache.baremaps.testing.TestFiles.LIECHTENSTEIN_OSM_PBF; -import static org.junit.jupiter.api.Assertions.assertEquals; - -import java.time.LocalDateTime; -import java.util.List; -import org.apache.baremaps.database.collection.AppendOnlyBuffer; -import org.apache.baremaps.database.collection.DataMap; -import org.apache.baremaps.database.collection.IndexedDataMap; -import org.apache.baremaps.database.memory.OnHeapMemory; -import org.apache.baremaps.database.type.LongListDataType; -import org.apache.baremaps.database.type.geometry.CoordinateDataType; -import org.apache.baremaps.openstreetmap.DiffService; -import org.apache.baremaps.openstreetmap.model.Header; -import org.apache.baremaps.openstreetmap.postgres.PostgresCoordinateMap; -import org.apache.baremaps.openstreetmap.postgres.PostgresHeaderRepository; -import org.apache.baremaps.openstreetmap.postgres.PostgresNodeRepository; -import org.apache.baremaps.openstreetmap.postgres.PostgresReferenceMap; -import org.apache.baremaps.openstreetmap.postgres.PostgresRelationRepository; -import org.apache.baremaps.openstreetmap.postgres.PostgresRepositoryTest; -import org.apache.baremaps.openstreetmap.postgres.PostgresWayRepository; -import org.junit.jupiter.api.Tag; -import org.junit.jupiter.api.Test; -import org.locationtech.jts.geom.Coordinate; - -class ImportUpdateLiechtensteinTest extends PostgresRepositoryTest { - - @Test - @Tag("integration") - void liechtenstein() throws Exception { - PostgresHeaderRepository headerRepository = new PostgresHeaderRepository(dataSource()); - PostgresNodeRepository nodeRepository = new PostgresNodeRepository(dataSource()); - PostgresWayRepository wayRepository = new PostgresWayRepository(dataSource()); - PostgresRelationRepository relationRepository = new PostgresRelationRepository(dataSource()); - - DataMap<Long, Coordinate> coordinateMap = - new IndexedDataMap<>(new AppendOnlyBuffer<>(new CoordinateDataType(), new OnHeapMemory())); - DataMap<Long, List<Long>> referenceMap = - new IndexedDataMap<>(new AppendOnlyBuffer<>(new LongListDataType(), new OnHeapMemory())); - - // Import data - ImportOsmPbf.execute(LIECHTENSTEIN_OSM_PBF, coordinateMap, referenceMap, - headerRepository, - nodeRepository, wayRepository, relationRepository, 3857); - - assertEquals(2434l, headerRepository.selectLatest().getReplicationSequenceNumber()); - - // Fix the replicationUrl so that we can update the database with local files - headerRepository.put(new Header(2434l, LocalDateTime.of(2019, 11, 18, 21, 19, 5, 0), - "file:///" + LIECHTENSTEIN_DIR, "", "")); - - coordinateMap = new PostgresCoordinateMap(dataSource()); - referenceMap = new PostgresReferenceMap(dataSource()); - - assertEquals(0, new DiffService(coordinateMap, referenceMap, headerRepository, nodeRepository, - wayRepository, relationRepository, 3857, 14).call().size()); - - // Update the database - UpdateOsmDatabase.execute(coordinateMap, referenceMap, headerRepository, nodeRepository, - wayRepository, - relationRepository, 3857, null); - assertEquals(2435l, headerRepository.selectLatest().getReplicationSequenceNumber()); - - assertEquals(2, new DiffService(coordinateMap, referenceMap, headerRepository, nodeRepository, - wayRepository, relationRepository, 3857, 14).call().size()); - - UpdateOsmDatabase.execute(coordinateMap, referenceMap, headerRepository, nodeRepository, - wayRepository, - relationRepository, 3857, null); - assertEquals(2436l, headerRepository.selectLatest().getReplicationSequenceNumber()); - - assertEquals(0, new DiffService(coordinateMap, referenceMap, headerRepository, nodeRepository, - wayRepository, relationRepository, 3857, 14).call().size()); - - UpdateOsmDatabase.execute(coordinateMap, referenceMap, headerRepository, nodeRepository, - wayRepository, - relationRepository, 3857, null); - assertEquals(2437l, headerRepository.selectLatest().getReplicationSequenceNumber()); - } -} diff --git a/baremaps-core/src/test/java/org/apache/baremaps/workflow/tasks/ImportUpdateSampleTest.java b/baremaps-core/src/test/java/org/apache/baremaps/workflow/tasks/ImportUpdateSampleTest.java new file mode 100644 index 00000000..055f7e1a --- /dev/null +++ b/baremaps-core/src/test/java/org/apache/baremaps/workflow/tasks/ImportUpdateSampleTest.java @@ -0,0 +1,121 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to you under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.baremaps.workflow.tasks; + +import static org.apache.baremaps.testing.GeometryAssertions.assertGeometryEquals; +import static org.apache.baremaps.testing.OsmSample.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; + +import java.nio.file.Files; +import java.util.List; +import org.apache.baremaps.database.collection.AppendOnlyBuffer; +import org.apache.baremaps.database.collection.DataMap; +import org.apache.baremaps.database.collection.IndexedDataMap; +import org.apache.baremaps.database.memory.OnHeapMemory; +import org.apache.baremaps.database.type.LongListDataType; +import org.apache.baremaps.database.type.geometry.CoordinateDataType; +import org.apache.baremaps.openstreetmap.model.Header; +import org.apache.baremaps.openstreetmap.postgres.PostgresCoordinateMap; +import org.apache.baremaps.openstreetmap.postgres.PostgresHeaderRepository; +import org.apache.baremaps.openstreetmap.postgres.PostgresNodeRepository; +import org.apache.baremaps.openstreetmap.postgres.PostgresReferenceMap; +import org.apache.baremaps.openstreetmap.postgres.PostgresRelationRepository; +import org.apache.baremaps.openstreetmap.postgres.PostgresRepositoryTest; +import org.apache.baremaps.openstreetmap.postgres.PostgresWayRepository; +import org.apache.baremaps.openstreetmap.state.StateReader; +import org.apache.baremaps.testing.OsmSample; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; +import org.locationtech.jts.geom.Coordinate; + +class ImportUpdateSampleTest extends PostgresRepositoryTest { + + @Test + @Tag("integration") + void sample() throws Exception { + int srid = 4326; + + // Initialize the repositories + PostgresHeaderRepository headerRepository = new PostgresHeaderRepository(dataSource()); + PostgresNodeRepository nodeRepository = new PostgresNodeRepository(dataSource()); + PostgresWayRepository wayRepository = new PostgresWayRepository(dataSource()); + PostgresRelationRepository relationRepository = new PostgresRelationRepository(dataSource()); + + // Initialize the data maps + DataMap<Long, Coordinate> coordinateMap = + new IndexedDataMap<>(new AppendOnlyBuffer<>(new CoordinateDataType(), new OnHeapMemory())); + DataMap<Long, List<Long>> referenceMap = + new IndexedDataMap<>(new AppendOnlyBuffer<>(new LongListDataType(), new OnHeapMemory())); + + // Import the sample data + ImportOsmPbf.execute(OsmSample.SAMPLE_OSM_PBF, coordinateMap, referenceMap, headerRepository, + nodeRepository, wayRepository, relationRepository, srid); + assertEquals(0, headerRepository.selectLatest().getReplicationSequenceNumber()); + + // Import the state file + try (var stateInput = Files.newInputStream(OsmSample.SAMPLE_STATE_TXT)) { + var state = new StateReader().readState(stateInput); + headerRepository.put(new Header(state.getSequenceNumber(), state.getTimestamp(), + "file:///" + OsmSample.SAMPLE_DIR, "", "")); + assertEquals(1, headerRepository.selectLatest().getReplicationSequenceNumber()); + } + assertGeometryEquals(NODE_POINT_1, nodeRepository.get(1L).getGeometry(), 100); + assertGeometryEquals(WAY_LINESTRING_4, wayRepository.get(4L).getGeometry(), 100); + assertGeometryEquals(WAY_POLYGON_9, wayRepository.get(9L).getGeometry(), 100); + assertGeometryEquals(RELATION_MULTIPOLYGON_20, relationRepository.get(20L).getGeometry(), 100); + assertGeometryEquals(RELATION_MULTIPOLYGON_36, relationRepository.get(36L).getGeometry(), 100); + + // Use the database as the reference instead of the original maps + coordinateMap = new PostgresCoordinateMap(dataSource()); + referenceMap = new PostgresReferenceMap(dataSource()); + + // Add elements to the database + UpdateOsmDatabase.execute(coordinateMap, referenceMap, headerRepository, nodeRepository, + wayRepository, relationRepository, srid, null); + assertEquals(2, headerRepository.selectLatest().getReplicationSequenceNumber()); + + assertGeometryEquals(NODE_POINT_37, nodeRepository.get(37L).getGeometry(), 100); + assertGeometryEquals(WAY_LINESTRING_40, wayRepository.get(40L).getGeometry(), 100); + assertGeometryEquals(WAY_POLYGON_45, wayRepository.get(45L).getGeometry(), 100); + assertGeometryEquals(RELATION_MULTIPOLYGON_56, relationRepository.get(56L).getGeometry(), 100); + assertGeometryEquals(RELATION_MULTIPOLYGON_72, relationRepository.get(72L).getGeometry(), 100); + + // Modify elements in the database + UpdateOsmDatabase.execute(coordinateMap, referenceMap, headerRepository, nodeRepository, + wayRepository, relationRepository, srid, null); + assertEquals(3, headerRepository.selectLatest().getReplicationSequenceNumber()); + assertGeometryEquals(NODE_POINT_1_MODIFIED, nodeRepository.get(1L).getGeometry(), 100); + assertGeometryEquals(WAY_LINESTRING_4_MODIFIED, wayRepository.get(4L).getGeometry(), 100); + assertGeometryEquals(WAY_POLYGON_9_MODIFIED, wayRepository.get(9L).getGeometry(), 100); + assertGeometryEquals(RELATION_MULTIPOLYGON_20_MODIFIED, + relationRepository.get(20L).getGeometry(), 100); + assertGeometryEquals(RELATION_MULTIPOLYGON_36_MODIFIED, + relationRepository.get(36L).getGeometry(), 100); + + // Delete elements from the database + UpdateOsmDatabase.execute(coordinateMap, referenceMap, headerRepository, nodeRepository, + wayRepository, relationRepository, srid, null); + assertEquals(4, headerRepository.selectLatest().getReplicationSequenceNumber()); + assertNull(nodeRepository.get(1L)); + assertNull(nodeRepository.get(4L)); + assertNull(nodeRepository.get(9L)); + assertNull(nodeRepository.get(20L)); + assertNull(nodeRepository.get(36L)); + } +} diff --git a/baremaps-core/src/test/resources/liechtenstein/000/002/435.osc.gz b/baremaps-core/src/test/resources/liechtenstein/000/002/435.osc.gz deleted file mode 100644 index fe5ae8f9..00000000 Binary files a/baremaps-core/src/test/resources/liechtenstein/000/002/435.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/liechtenstein/000/002/435.state.txt b/baremaps-core/src/test/resources/liechtenstein/000/002/435.state.txt deleted file mode 100644 index 1648cf94..00000000 --- a/baremaps-core/src/test/resources/liechtenstein/000/002/435.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 3766766 -timestamp=2019-11-19T21\:18\:02Z -sequenceNumber=2435 \ No newline at end of file diff --git a/baremaps-core/src/test/resources/liechtenstein/000/002/436.osc.gz b/baremaps-core/src/test/resources/liechtenstein/000/002/436.osc.gz deleted file mode 100644 index a78d4628..00000000 Binary files a/baremaps-core/src/test/resources/liechtenstein/000/002/436.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/liechtenstein/000/002/436.state.txt b/baremaps-core/src/test/resources/liechtenstein/000/002/436.state.txt deleted file mode 100644 index 2724e3ba..00000000 --- a/baremaps-core/src/test/resources/liechtenstein/000/002/436.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 3768197 -timestamp=2019-11-20T21\:18\:03Z -sequenceNumber=2436 \ No newline at end of file diff --git a/baremaps-core/src/test/resources/liechtenstein/000/002/437.osc.gz b/baremaps-core/src/test/resources/liechtenstein/000/002/437.osc.gz deleted file mode 100644 index 7084d86b..00000000 Binary files a/baremaps-core/src/test/resources/liechtenstein/000/002/437.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/liechtenstein/000/002/437.state.txt b/baremaps-core/src/test/resources/liechtenstein/000/002/437.state.txt deleted file mode 100644 index da46be26..00000000 --- a/baremaps-core/src/test/resources/liechtenstein/000/002/437.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 3769638 -timestamp=2019-11-21T21\:19\:02Z -sequenceNumber=2437 \ No newline at end of file diff --git a/baremaps-core/src/test/resources/liechtenstein/liechtenstein.osm.pbf b/baremaps-core/src/test/resources/liechtenstein/liechtenstein.osm.pbf deleted file mode 100644 index 13eeed6b..00000000 Binary files a/baremaps-core/src/test/resources/liechtenstein/liechtenstein.osm.pbf and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/047.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/047.osc.gz deleted file mode 100644 index ec3119a3..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/047.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/047.state.txt b/baremaps-core/src/test/resources/monaco/000/003/047.state.txt deleted file mode 100644 index 8bbb79ee..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/047.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4652924 -timestamp=2021-08-01T20\:21\:40Z -sequenceNumber=3047 diff --git a/baremaps-core/src/test/resources/monaco/000/003/048.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/048.osc.gz deleted file mode 100644 index 0c331197..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/048.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/048.state.txt b/baremaps-core/src/test/resources/monaco/000/003/048.state.txt deleted file mode 100644 index 9e559340..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/048.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4654341 -timestamp=2021-08-02T20\:21\:57Z -sequenceNumber=3048 diff --git a/baremaps-core/src/test/resources/monaco/000/003/049.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/049.osc.gz deleted file mode 100644 index ec3119a3..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/049.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/049.state.txt b/baremaps-core/src/test/resources/monaco/000/003/049.state.txt deleted file mode 100644 index 75931aac..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/049.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4655756 -timestamp=2021-08-03T20\:21\:39Z -sequenceNumber=3049 diff --git a/baremaps-core/src/test/resources/monaco/000/003/050.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/050.osc.gz deleted file mode 100644 index 1408161c..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/050.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/050.state.txt b/baremaps-core/src/test/resources/monaco/000/003/050.state.txt deleted file mode 100644 index 426f1093..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/050.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4657170 -timestamp=2021-08-04T20\:21\:26Z -sequenceNumber=3050 diff --git a/baremaps-core/src/test/resources/monaco/000/003/051.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/051.osc.gz deleted file mode 100644 index 94b77b65..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/051.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/051.state.txt b/baremaps-core/src/test/resources/monaco/000/003/051.state.txt deleted file mode 100644 index a4f474e2..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/051.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4658582 -timestamp=2021-08-05T20\:21\:36Z -sequenceNumber=3051 diff --git a/baremaps-core/src/test/resources/monaco/000/003/052.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/052.osc.gz deleted file mode 100644 index 488924cf..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/052.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/052.state.txt b/baremaps-core/src/test/resources/monaco/000/003/052.state.txt deleted file mode 100644 index 2dfba920..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/052.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4659995 -timestamp=2021-08-06T20\:21\:14Z -sequenceNumber=3052 diff --git a/baremaps-core/src/test/resources/monaco/000/003/053.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/053.osc.gz deleted file mode 100644 index ec3119a3..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/053.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/053.state.txt b/baremaps-core/src/test/resources/monaco/000/003/053.state.txt deleted file mode 100644 index 49d1c272..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/053.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4661407 -timestamp=2021-08-07T20\:21\:04Z -sequenceNumber=3053 diff --git a/baremaps-core/src/test/resources/monaco/000/003/054.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/054.osc.gz deleted file mode 100644 index 2ba0b348..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/054.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/054.state.txt b/baremaps-core/src/test/resources/monaco/000/003/054.state.txt deleted file mode 100644 index 59e843b8..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/054.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4662821 -timestamp=2021-08-08T20\:21\:48Z -sequenceNumber=3054 diff --git a/baremaps-core/src/test/resources/monaco/000/003/055.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/055.osc.gz deleted file mode 100644 index ec3119a3..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/055.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/055.state.txt b/baremaps-core/src/test/resources/monaco/000/003/055.state.txt deleted file mode 100644 index 287c8e34..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/055.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4664236 -timestamp=2021-08-09T20\:21\:57Z -sequenceNumber=3055 diff --git a/baremaps-core/src/test/resources/monaco/000/003/056.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/056.osc.gz deleted file mode 100644 index ec3119a3..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/056.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/056.state.txt b/baremaps-core/src/test/resources/monaco/000/003/056.state.txt deleted file mode 100644 index 740cb08c..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/056.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4665651 -timestamp=2021-08-10T20\:21\:58Z -sequenceNumber=3056 diff --git a/baremaps-core/src/test/resources/monaco/000/003/057.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/057.osc.gz deleted file mode 100644 index ec3119a3..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/057.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/057.state.txt b/baremaps-core/src/test/resources/monaco/000/003/057.state.txt deleted file mode 100644 index 90b699be..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/057.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4667064 -timestamp=2021-08-11T20\:21\:58Z -sequenceNumber=3057 diff --git a/baremaps-core/src/test/resources/monaco/000/003/058.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/058.osc.gz deleted file mode 100644 index 42a1247d..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/058.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/058.state.txt b/baremaps-core/src/test/resources/monaco/000/003/058.state.txt deleted file mode 100644 index aad74fda..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/058.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4668475 -timestamp=2021-08-12T20\:21\:59Z -sequenceNumber=3058 diff --git a/baremaps-core/src/test/resources/monaco/000/003/059.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/059.osc.gz deleted file mode 100644 index ec3119a3..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/059.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/059.state.txt b/baremaps-core/src/test/resources/monaco/000/003/059.state.txt deleted file mode 100644 index c991cbf4..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/059.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4669887 -timestamp=2021-08-13T20\:21\:42Z -sequenceNumber=3059 diff --git a/baremaps-core/src/test/resources/monaco/000/003/060.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/060.osc.gz deleted file mode 100644 index 1a32ea74..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/060.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/060.state.txt b/baremaps-core/src/test/resources/monaco/000/003/060.state.txt deleted file mode 100644 index 94ba1ace..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/060.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4671297 -timestamp=2021-08-14T20\:21\:23Z -sequenceNumber=3060 diff --git a/baremaps-core/src/test/resources/monaco/000/003/061.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/061.osc.gz deleted file mode 100644 index ec3119a3..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/061.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/061.state.txt b/baremaps-core/src/test/resources/monaco/000/003/061.state.txt deleted file mode 100644 index fb530bf1..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/061.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4672708 -timestamp=2021-08-15T20\:21\:13Z -sequenceNumber=3061 diff --git a/baremaps-core/src/test/resources/monaco/000/003/062.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/062.osc.gz deleted file mode 100644 index ec3119a3..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/062.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/062.state.txt b/baremaps-core/src/test/resources/monaco/000/003/062.state.txt deleted file mode 100644 index 7fe7092c..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/062.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4674117 -timestamp=2021-08-16T20\:21\:13Z -sequenceNumber=3062 diff --git a/baremaps-core/src/test/resources/monaco/000/003/063.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/063.osc.gz deleted file mode 100644 index 372e1f91..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/063.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/063.state.txt b/baremaps-core/src/test/resources/monaco/000/003/063.state.txt deleted file mode 100644 index 07cc25b1..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/063.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4675529 -timestamp=2021-08-17T20\:21\:54Z -sequenceNumber=3063 diff --git a/baremaps-core/src/test/resources/monaco/000/003/064.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/064.osc.gz deleted file mode 100644 index ec3119a3..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/064.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/064.state.txt b/baremaps-core/src/test/resources/monaco/000/003/064.state.txt deleted file mode 100644 index a5faf1fb..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/064.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4676940 -timestamp=2021-08-18T20\:21\:43Z -sequenceNumber=3064 diff --git a/baremaps-core/src/test/resources/monaco/000/003/065.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/065.osc.gz deleted file mode 100644 index 7482b67d..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/065.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/065.state.txt b/baremaps-core/src/test/resources/monaco/000/003/065.state.txt deleted file mode 100644 index 536817a1..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/065.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4678351 -timestamp=2021-08-19T20\:21\:13Z -sequenceNumber=3065 diff --git a/baremaps-core/src/test/resources/monaco/000/003/066.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/066.osc.gz deleted file mode 100644 index 3782609f..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/066.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/066.state.txt b/baremaps-core/src/test/resources/monaco/000/003/066.state.txt deleted file mode 100644 index 4d97e67f..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/066.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4679763 -timestamp=2021-08-20T20\:21\:29Z -sequenceNumber=3066 diff --git a/baremaps-core/src/test/resources/monaco/000/003/067.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/067.osc.gz deleted file mode 100644 index ec3119a3..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/067.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/067.state.txt b/baremaps-core/src/test/resources/monaco/000/003/067.state.txt deleted file mode 100644 index 05514608..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/067.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4681175 -timestamp=2021-08-21T20\:22\:01Z -sequenceNumber=3067 diff --git a/baremaps-core/src/test/resources/monaco/000/003/068.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/068.osc.gz deleted file mode 100644 index c417fb7b..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/068.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/068.state.txt b/baremaps-core/src/test/resources/monaco/000/003/068.state.txt deleted file mode 100644 index e8d54002..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/068.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4682586 -timestamp=2021-08-22T20\:21\:03Z -sequenceNumber=3068 diff --git a/baremaps-core/src/test/resources/monaco/000/003/069.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/069.osc.gz deleted file mode 100644 index ec3119a3..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/069.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/069.state.txt b/baremaps-core/src/test/resources/monaco/000/003/069.state.txt deleted file mode 100644 index 66bbc634..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/069.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4684000 -timestamp=2021-08-23T20\:21\:32Z -sequenceNumber=3069 diff --git a/baremaps-core/src/test/resources/monaco/000/003/070.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/070.osc.gz deleted file mode 100644 index ec3119a3..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/070.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/070.state.txt b/baremaps-core/src/test/resources/monaco/000/003/070.state.txt deleted file mode 100644 index 03370b22..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/070.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4685413 -timestamp=2021-08-24T20\:22\:03Z -sequenceNumber=3070 diff --git a/baremaps-core/src/test/resources/monaco/000/003/071.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/071.osc.gz deleted file mode 100644 index ec3119a3..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/071.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/071.state.txt b/baremaps-core/src/test/resources/monaco/000/003/071.state.txt deleted file mode 100644 index 9c127560..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/071.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4686823 -timestamp=2021-08-25T20\:21\:18Z -sequenceNumber=3071 diff --git a/baremaps-core/src/test/resources/monaco/000/003/072.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/072.osc.gz deleted file mode 100644 index 73584bbe..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/072.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/072.state.txt b/baremaps-core/src/test/resources/monaco/000/003/072.state.txt deleted file mode 100644 index 9dfe5595..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/072.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4688234 -timestamp=2021-08-26T20\:21\:28Z -sequenceNumber=3072 diff --git a/baremaps-core/src/test/resources/monaco/000/003/073.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/073.osc.gz deleted file mode 100644 index ec3119a3..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/073.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/073.state.txt b/baremaps-core/src/test/resources/monaco/000/003/073.state.txt deleted file mode 100644 index 97fd1224..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/073.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4689645 -timestamp=2021-08-27T20\:21\:28Z -sequenceNumber=3073 diff --git a/baremaps-core/src/test/resources/monaco/000/003/074.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/074.osc.gz deleted file mode 100644 index ec3119a3..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/074.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/074.state.txt b/baremaps-core/src/test/resources/monaco/000/003/074.state.txt deleted file mode 100644 index e9640348..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/074.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4691055 -timestamp=2021-08-28T20\:21\:12Z -sequenceNumber=3074 diff --git a/baremaps-core/src/test/resources/monaco/000/003/075.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/075.osc.gz deleted file mode 100644 index ec3119a3..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/075.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/075.state.txt b/baremaps-core/src/test/resources/monaco/000/003/075.state.txt deleted file mode 100644 index 7a9ddc89..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/075.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4692466 -timestamp=2021-08-29T20\:22\:02Z -sequenceNumber=3075 diff --git a/baremaps-core/src/test/resources/monaco/000/003/076.osc.gz b/baremaps-core/src/test/resources/monaco/000/003/076.osc.gz deleted file mode 100644 index 9a1688f4..00000000 Binary files a/baremaps-core/src/test/resources/monaco/000/003/076.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/000/003/076.state.txt b/baremaps-core/src/test/resources/monaco/000/003/076.state.txt deleted file mode 100644 index 72b6a55c..00000000 --- a/baremaps-core/src/test/resources/monaco/000/003/076.state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4693877 -timestamp=2021-08-30T20\:21\:43Z -sequenceNumber=3076 diff --git a/baremaps-core/src/test/resources/monaco/monaco-210801.osm.pbf b/baremaps-core/src/test/resources/monaco/monaco-210801.osm.pbf deleted file mode 100644 index 2ac63801..00000000 Binary files a/baremaps-core/src/test/resources/monaco/monaco-210801.osm.pbf and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/monaco-state.txt b/baremaps-core/src/test/resources/monaco/monaco-state.txt deleted file mode 100644 index 084d926e..00000000 --- a/baremaps-core/src/test/resources/monaco/monaco-state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4277737 -timestamp=2020-11-10T21\:42\:03Z -sequenceNumber=2788 \ No newline at end of file diff --git a/baremaps-core/src/test/resources/monaco/monaco.osc.gz b/baremaps-core/src/test/resources/monaco/monaco.osc.gz deleted file mode 100644 index 8af359d8..00000000 Binary files a/baremaps-core/src/test/resources/monaco/monaco.osc.gz and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/monaco.osm.bz2 b/baremaps-core/src/test/resources/monaco/monaco.osm.bz2 deleted file mode 100644 index 3cbb5e03..00000000 Binary files a/baremaps-core/src/test/resources/monaco/monaco.osm.bz2 and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/monaco.osm.pbf b/baremaps-core/src/test/resources/monaco/monaco.osm.pbf deleted file mode 100644 index bbbbfcf6..00000000 Binary files a/baremaps-core/src/test/resources/monaco/monaco.osm.pbf and /dev/null differ diff --git a/baremaps-core/src/test/resources/monaco/state.txt b/baremaps-core/src/test/resources/monaco/state.txt deleted file mode 100644 index 9b417958..00000000 --- a/baremaps-core/src/test/resources/monaco/state.txt +++ /dev/null @@ -1,3 +0,0 @@ -# original OSM minutely replication sequence number 4756152 -timestamp=2021-10-13T20\:21\:28Z -sequenceNumber=3119 diff --git a/baremaps-core/src/test/resources/osm-sample/000/000/002.osc.gz b/baremaps-core/src/test/resources/osm-sample/000/000/002.osc.gz new file mode 100644 index 00000000..0442c86f Binary files /dev/null and b/baremaps-core/src/test/resources/osm-sample/000/000/002.osc.gz differ diff --git a/baremaps-core/src/test/resources/osm-sample/000/000/002.osc.xml b/baremaps-core/src/test/resources/osm-sample/000/000/002.osc.xml new file mode 100644 index 00000000..951c64f0 --- /dev/null +++ b/baremaps-core/src/test/resources/osm-sample/000/000/002.osc.xml @@ -0,0 +1,122 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to you under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> +<osmChange generator="sample" version="0.6"> + <create> + <node id="37" lat="6.0" lon="6.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"> + <tag k="type" v="point"/> + </node> + </create> + <create> + <node id="38" lat="7.0" lon="7.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <node id="39" lat="8.0" lon="8.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <way id="40" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"> + <tag k="type" v="line"/> + <nd ref="38"/> + <nd ref="39"/> + </way> + </create> + <create> + <node id="41" lat="8.0" lon="8.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <node id="42" lat="9.0" lon="8.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <node id="43" lat="9.0" lon="9.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <node id="44" lat="8.0" lon="9.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <way id="45" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"> + <tag k="type" v="polygon"/> + <nd ref="41"/> + <nd ref="42"/> + <nd ref="43"/> + <nd ref="44"/> + <nd ref="41"/> + </way> + </create> + <create> + <node id="46" lat="9.0" lon="9.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <node id="47" lat="10.0" lon="9.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <node id="48" lat="10.0" lon="10.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <node id="49" lat="9.0" lon="10.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <way id="50" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"> + <tag k="type" v="polygon"/> + <nd ref="46"/> + <nd ref="47"/> + <nd ref="48"/> + <nd ref="49"/> + <nd ref="46"/> + </way> + <node id="51" lat="9.4" lon="9.4" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <node id="52" lat="9.6" lon="9.4" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <node id="53" lat="9.6" lon="9.6" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <node id="54" lat="9.4" lon="9.6" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <way id="55" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"> + <tag k="type" v="polygon"/> + <nd ref="51"/> + <nd ref="52"/> + <nd ref="53"/> + <nd ref="54"/> + <nd ref="51"/> + </way> + <relation id="56" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"> + <tag k="type" v="multipolygon"/> + <member type="way" ref="50" role=""/> + <member type="way" ref="55" role=""/> + </relation> + </create> + <create> + <node id="57" lat="10.0" lon="10.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <node id="58" lat="10.6" lon="10.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <node id="59" lat="10.6" lon="10.6" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <node id="60" lat="10.0" lon="10.6" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <way id="61" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"> + <tag k="type" v="polygon"/> + <nd ref="57"/> + <nd ref="58"/> + <nd ref="59"/> + <nd ref="60"/> + <nd ref="57"/> + </way> + <node id="62" lat="10.2" lon="10.2" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <node id="63" lat="10.4" lon="10.2" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <node id="64" lat="10.4" lon="10.4" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <node id="65" lat="10.2" lon="10.4" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <way id="66" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"> + <tag k="type" v="polygon"/> + <nd ref="62"/> + <nd ref="63"/> + <nd ref="64"/> + <nd ref="65"/> + <nd ref="62"/> + </way> + <node id="67" lat="10.8" lon="10.8" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <node id="68" lat="11.0" lon="10.8" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <node id="69" lat="11.0" lon="11.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <node id="70" lat="10.8" lon="11.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"/> + <way id="71" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"> + <tag k="type" v="polygon"/> + <nd ref="67"/> + <nd ref="68"/> + <nd ref="69"/> + <nd ref="70"/> + <nd ref="67"/> + </way> + <relation id="72" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-02T00:00:00Z"> + <tag k="type" v="multipolygon"/> + <member type="way" ref="61" role=""/> + <member type="way" ref="66" role=""/> + <member type="way" ref="71" role=""/> + </relation> + </create> +</osmChange> \ No newline at end of file diff --git a/baremaps-core/src/test/resources/osm-sample/000/000/002.state.txt b/baremaps-core/src/test/resources/osm-sample/000/000/002.state.txt new file mode 100644 index 00000000..60a98f60 --- /dev/null +++ b/baremaps-core/src/test/resources/osm-sample/000/000/002.state.txt @@ -0,0 +1,2 @@ +timestamp=2000-01-02T00\:00\:00Z +sequenceNumber=2 \ No newline at end of file diff --git a/baremaps-core/src/test/resources/osm-sample/000/000/003.osc.gz b/baremaps-core/src/test/resources/osm-sample/000/000/003.osc.gz new file mode 100644 index 00000000..a754c1ec Binary files /dev/null and b/baremaps-core/src/test/resources/osm-sample/000/000/003.osc.gz differ diff --git a/baremaps-core/src/test/resources/osm-sample/000/000/003.osc.xml b/baremaps-core/src/test/resources/osm-sample/000/000/003.osc.xml new file mode 100644 index 00000000..c63525e6 --- /dev/null +++ b/baremaps-core/src/test/resources/osm-sample/000/000/003.osc.xml @@ -0,0 +1,136 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to you under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> +<osmChange generator="sample" version="0.6"> + <modify> + <node id="1" lat="0.5" lon="0.5" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-03T00:00:00Z"> + <tag k="type" v="point"/> + <tag k="note" v="modified"/> + </node> + </modify> + <modify> + <node id="2" lat="1.2" lon="1.2" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-03T00:00:00Z"/> + <node id="3" lat="1.8" lon="1.8" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-03T00:00:00Z"/> + <way id="4" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-03T00:00:00Z"> + <tag k="type" v="line"/> + <tag k="note" v="modified"/> + <nd ref="2"/> + <nd ref="3"/> + </way> + </modify> + <modify> + <!-- way (polygon) --> + <node id="5" lat="2.1" lon="2.1" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="6" lat="2.9" lon="2.1" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="7" lat="2.9" lon="2.9" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="8" lat="2.1" lon="2.9" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <way id="9" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> + <tag k="type" v="polygon"/> + <tag k="note" v="modified"/> + <nd ref="5"/> + <nd ref="6"/> + <nd ref="7"/> + <nd ref="8"/> + <nd ref="5"/> + </way> + </modify> + <modify> + <node id="10" lat="3.0" lon="3.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="11" lat="4.0" lon="3.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="12" lat="4.0" lon="4.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="13" lat="3.0" lon="4.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <way id="14" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> + <tag k="type" v="polygon"/> + <tag k="note" v="modified"/> + <nd ref="10"/> + <nd ref="11"/> + <nd ref="12"/> + <nd ref="13"/> + <nd ref="10"/> + </way> + <node id="15" lat="3.5" lon="3.5" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="16" lat="3.6" lon="3.5" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="17" lat="3.6" lon="3.6" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="18" lat="3.5" lon="3.6" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <way id="19" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> + <tag k="type" v="polygon"/> + <tag k="note" v="modified"/> + <nd ref="15"/> + <nd ref="16"/> + <nd ref="17"/> + <nd ref="18"/> + <nd ref="15"/> + </way> + <relation id="20" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> + <tag k="type" v="multipolygon"/> + <tag k="note" v="modified"/> + <member type="way" ref="14" role=""/> + <member type="way" ref="19" role=""/> + </relation> + </modify> + <modify> + <node id="21" lat="4.0" lon="4.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="22" lat="4.6" lon="4.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="23" lat="4.6" lon="4.6" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="24" lat="4.0" lon="4.6" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <way id="25" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> + <tag k="type" v="polygon"/> + <tag k="description" v="outer ring"/> + <tag k="note" v="modified"/> + <nd ref="21"/> + <nd ref="22"/> + <nd ref="23"/> + <nd ref="24"/> + <nd ref="21"/> + </way> + <node id="26" lat="4.2" lon="4.2" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="27" lat="4.4" lon="4.2" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="28" lat="4.4" lon="4.4" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="29" lat="4.2" lon="4.4" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <way id="30" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> + <tag k="type" v="polygon"/> + <tag k="description" v="inner ring"/> + <tag k="note" v="modified"/> + <nd ref="26"/> + <nd ref="27"/> + <nd ref="28"/> + <nd ref="29"/> + <nd ref="26"/> + </way> + <node id="31" lat="4.9" lon="4.9" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="32" lat="5.0" lon="4.9" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="33" lat="5.0" lon="5.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="34" lat="4.9" lon="5.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <way id="35" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> + <tag k="type" v="polygon"/> + <tag k="description" v="island"/> + <tag k="note" v="modified"/> + <nd ref="31"/> + <nd ref="32"/> + <nd ref="33"/> + <nd ref="34"/> + <nd ref="31"/> + </way> + <relation id="36" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> + <tag k="type" v="multipolygon"/> + <tag k="note" v="modified"/> + <member type="way" ref="25" role=""/> + <member type="way" ref="30" role=""/> + <member type="way" ref="35" role=""/> + </relation> + </modify> +</osmChange> \ No newline at end of file diff --git a/baremaps-core/src/test/resources/osm-sample/000/000/003.state.txt b/baremaps-core/src/test/resources/osm-sample/000/000/003.state.txt new file mode 100644 index 00000000..736cc846 --- /dev/null +++ b/baremaps-core/src/test/resources/osm-sample/000/000/003.state.txt @@ -0,0 +1,2 @@ +timestamp=2000-01-03T00\:00\:00Z +sequenceNumber=3 \ No newline at end of file diff --git a/baremaps-core/src/test/resources/osm-sample/000/000/004.osc.gz b/baremaps-core/src/test/resources/osm-sample/000/000/004.osc.gz new file mode 100644 index 00000000..411cdac7 Binary files /dev/null and b/baremaps-core/src/test/resources/osm-sample/000/000/004.osc.gz differ diff --git a/baremaps-core/src/test/resources/osm-sample/000/000/004.osc.xml b/baremaps-core/src/test/resources/osm-sample/000/000/004.osc.xml new file mode 100644 index 00000000..33c8a1fe --- /dev/null +++ b/baremaps-core/src/test/resources/osm-sample/000/000/004.osc.xml @@ -0,0 +1,26 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to you under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> +<osmChange generator="sample" version="0.6"> + <delete> + <node id="1" version="1" changeset="4" user="user" uid="1" visible="true" timestamp="2000-01-04T00:00:00Z" /> + <way id="4" version="1" changeset="4" user="user" uid="1" visible="true" timestamp="2000-01-04T00:00:00Z" /> + <way id="9" version="1" changeset="4" user="user" uid="1" visible="true" timestamp="2000-01-04T00:00:00Z" /> + <relation id="20" version="1" changeset="4" user="user" uid="1" visible="true" timestamp="2000-01-04T00:00:00Z" /> + <relation id="36" version="1" changeset="4" user="user" uid="1" visible="true" timestamp="2000-01-04T00:00:00Z" /> + </delete> +</osmChange> \ No newline at end of file diff --git a/baremaps-core/src/test/resources/osm-sample/000/000/004.state.txt b/baremaps-core/src/test/resources/osm-sample/000/000/004.state.txt new file mode 100644 index 00000000..c09488d3 --- /dev/null +++ b/baremaps-core/src/test/resources/osm-sample/000/000/004.state.txt @@ -0,0 +1,2 @@ +timestamp=2000-01-04T00\:00\:00Z +sequenceNumber=4 \ No newline at end of file diff --git a/baremaps-core/src/test/resources/osm-sample/build.sh b/baremaps-core/src/test/resources/osm-sample/build.sh new file mode 100755 index 00000000..4b4e6fc7 --- /dev/null +++ b/baremaps-core/src/test/resources/osm-sample/build.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +osmium cat sample.osm.xml -o sample.osm.pbf -f sample.pbf --overwrite +cd 000/000/ +rm 001.osc.gz && gzip -k 001.osc.xml && mv 001.osc.xml.gz 001.osc.gz +rm 002.osc.gz && gzip -k 002.osc.xml && mv 002.osc.xml.gz 002.osc.gz +rm 003.osc.gz && gzip -k 003.osc.xml && mv 003.osc.xml.gz 003.osc.gz +rm 004.osc.gz && gzip -k 004.osc.xml && mv 004.osc.xml.gz 004.osc.gz +cd - \ No newline at end of file diff --git a/baremaps-core/src/test/resources/osm-sample/sample.osm.pbf b/baremaps-core/src/test/resources/osm-sample/sample.osm.pbf new file mode 100644 index 00000000..1af8b81e Binary files /dev/null and b/baremaps-core/src/test/resources/osm-sample/sample.osm.pbf differ diff --git a/baremaps-core/src/test/resources/samples/sample.osm.xml b/baremaps-core/src/test/resources/osm-sample/sample.osm.xml similarity index 54% rename from baremaps-core/src/test/resources/samples/sample.osm.xml rename to baremaps-core/src/test/resources/osm-sample/sample.osm.xml index 0407fa36..87a5b111 100644 --- a/baremaps-core/src/test/resources/samples/sample.osm.xml +++ b/baremaps-core/src/test/resources/osm-sample/sample.osm.xml @@ -15,112 +15,112 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> -<osm version="0.6" generator="sample" upload="false"> +<osm version="0.6" generator="osmium/1.16.0" upload="false"> + <bounds minlat="0.0" minlon="0.0" maxlat="20.0" maxlon="20.0"/> + <!-- node --> - <node id="0" lat="0.0" lon="0.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> + <node id="1" lat="0.0" lon="0.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> <tag k="type" v="point"/> </node> <!-- way (line) --> - <node id="1" lat="1.0" lon="1.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="2" lat="2.0" lon="2.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <way id="1" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> + <node id="2" lat="1.0" lon="1.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="3" lat="2.0" lon="2.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <way id="4" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> <tag k="type" v="line"/> - <nd ref="1"/> <nd ref="2"/> + <nd ref="3"/> </way> <!-- way (polygon) --> - <node id="3" lat="2.0" lon="2.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="4" lat="3.0" lon="2.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="5" lat="3.0" lon="3.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="6" lat="2.0" lon="3.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <way id="2" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> + <node id="5" lat="2.0" lon="2.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="6" lat="3.0" lon="2.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="7" lat="3.0" lon="3.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="8" lat="2.0" lon="3.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <way id="9" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> <tag k="type" v="polygon"/> - <nd ref="3"/> - <nd ref="4"/> <nd ref="5"/> <nd ref="6"/> - <nd ref="3"/> + <nd ref="7"/> + <nd ref="8"/> + <nd ref="5"/> </way> <!-- relation (polygon with hole) --> - <node id="7" lat="3.0" lon="3.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="8" lat="4.0" lon="3.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="9" lat="4.0" lon="4.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="10" lat="3.0" lon="4.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <way id="3" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> + <node id="10" lat="3.0" lon="3.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="11" lat="4.0" lon="3.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="12" lat="4.0" lon="4.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="13" lat="3.0" lon="4.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <way id="14" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> <tag k="type" v="polygon"/> - <nd ref="7"/> - <nd ref="8"/> - <nd ref="9"/> <nd ref="10"/> - <nd ref="7"/> - </way> - <node id="11" lat="3.4" lon="3.4" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="12" lat="3.6" lon="3.4" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="13" lat="3.6" lon="3.6" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="14" lat="3.4" lon="3.6" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <way id="4" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> - <tag k="type" v="polygon"/> <nd ref="11"/> <nd ref="12"/> <nd ref="13"/> - <nd ref="14"/> - <nd ref="11"/> + <nd ref="10"/> </way> - <relation id="1" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> - <tag k="type" v="multipolygon"/> - <member type="way" ref="3" role=""/> - <member type="way" ref="4" role=""/> - </relation> - - <!-- relation (polygon with island and hole) --> - <node id="15" lat="4.0" lon="4.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="16" lat="4.6" lon="4.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="17" lat="4.6" lon="4.6" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="18" lat="4.0" lon="4.6" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <way id="5" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> + <node id="15" lat="3.4" lon="3.4" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="16" lat="3.6" lon="3.4" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="17" lat="3.6" lon="3.6" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="18" lat="3.4" lon="3.6" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <way id="19" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> <tag k="type" v="polygon"/> - <tag k="description" v="outer ring"/> <nd ref="15"/> <nd ref="16"/> <nd ref="17"/> <nd ref="18"/> <nd ref="15"/> </way> - <node id="19" lat="4.2" lon="4.2" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="20" lat="4.4" lon="4.2" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="21" lat="4.4" lon="4.4" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="22" lat="4.2" lon="4.4" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <way id="6" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> + <relation id="20" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> + <tag k="type" v="multipolygon"/> + <member type="way" ref="14" role=""/> + <member type="way" ref="19" role=""/> + </relation> + + <!-- relation (polygon with island and hole) --> + <node id="21" lat="4.0" lon="4.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="22" lat="4.6" lon="4.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="23" lat="4.6" lon="4.6" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="24" lat="4.0" lon="4.6" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <way id="25" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> <tag k="type" v="polygon"/> - <tag k="description" v="inner ring"/> - <nd ref="19"/> - <nd ref="20"/> + <tag k="description" v="outer ring"/> <nd ref="21"/> <nd ref="22"/> - <nd ref="19"/> - </way> - <node id="23" lat="4.8" lon="4.8" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="24" lat="5.0" lon="4.8" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="25" lat="5.0" lon="5.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="26" lat="4.8" lon="5.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <way id="7" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> - <tag k="type" v="polygon"/> - <tag k="description" v="island"/> <nd ref="23"/> <nd ref="24"/> - <nd ref="25"/> + <nd ref="21"/> + </way> + <node id="26" lat="4.2" lon="4.2" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="27" lat="4.4" lon="4.2" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="28" lat="4.4" lon="4.4" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="29" lat="4.2" lon="4.4" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <way id="30" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> + <tag k="type" v="polygon"/> + <tag k="description" v="inner ring"/> + <nd ref="26"/> + <nd ref="27"/> + <nd ref="28"/> + <nd ref="29"/> <nd ref="26"/> - <nd ref="23"/> </way> - <relation id="2" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> + <node id="31" lat="4.8" lon="4.8" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="32" lat="5.0" lon="4.8" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="33" lat="5.0" lon="5.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <node id="34" lat="4.8" lon="5.0" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> + <way id="35" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> + <tag k="type" v="polygon"/> + <tag k="description" v="island"/> + <nd ref="31"/> + <nd ref="32"/> + <nd ref="33"/> + <nd ref="34"/> + <nd ref="31"/> + </way> + <relation id="36" version="1" changeset="1" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> <tag k="type" v="multipolygon"/> - <member type="way" ref="5" role=""/> - <member type="way" ref="6" role=""/> - <member type="way" ref="7" role=""/> + <member type="way" ref="25" role=""/> + <member type="way" ref="30" role=""/> + <member type="way" ref="35" role=""/> </relation> - - </osm> diff --git a/baremaps-core/src/test/resources/osm-sample/state.txt b/baremaps-core/src/test/resources/osm-sample/state.txt new file mode 100644 index 00000000..b017e0a7 --- /dev/null +++ b/baremaps-core/src/test/resources/osm-sample/state.txt @@ -0,0 +1,2 @@ +timestamp=2000-01-01T00\:00\:00Z +sequenceNumber=1 \ No newline at end of file diff --git a/baremaps-core/src/test/resources/samples/sample.osc.xml b/baremaps-core/src/test/resources/samples/sample.osc.xml deleted file mode 100644 index 8789d9cf..00000000 --- a/baremaps-core/src/test/resources/samples/sample.osc.xml +++ /dev/null @@ -1,191 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- -Licensed to the Apache Software Foundation (ASF) under one or more -contributor license agreements. See the NOTICE file distributed with -this work for additional information regarding copyright ownership. -The ASF licenses this file to you under the Apache License, Version 2.0 -(the "License"); you may not use this file except in compliance with -the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. ---> -<osmChange generator="sample" version="0.6"> - <create> - <!-- node (point) --> - <node id="27" lat="6.0" lon="6.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> - <tag k="type" v="point"/> - </node> - </create> - - <create> - <!-- way (line) --> - <node id="28" lat="7.0" lon="7.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="29" lat="8.0" lon="8.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <way id="5" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> - <tag k="type" v="line"/> - <nd ref="28"/> - <nd ref="29"/> - </way> - </create> - - <create> - <!-- way (polygon) --> - <node id="30" lat="8.0" lon="8.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="31" lat="9.0" lon="8.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="32" lat="9.0" lon="9.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="33" lat="8.0" lon="9.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <way id="6" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> - <tag k="type" v="polygon"/> - <nd ref="30"/> - <nd ref="31"/> - <nd ref="32"/> - <nd ref="33"/> - <nd ref="30"/> - </way> - </create> - - <create> - <!-- relation (polygon with hole) --> - <node id="34" lat="9.0" lon="9.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="35" lat="10.0" lon="9.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="36" lat="10.0" lon="10.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="37" lat="9.0" lon="10.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <way id="7" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> - <tag k="type" v="polygon"/> - <nd ref="34"/> - <nd ref="35"/> - <nd ref="36"/> - <nd ref="37"/> - <nd ref="34"/> - </way> - <node id="38" lat="9.4" lon="9.4" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="39" lat="9.6" lon="9.4" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="40" lat="9.6" lon="9.6" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="41" lat="9.4" lon="9.6" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <way id="8" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> - <tag k="type" v="polygon"/> - <nd ref="38"/> - <nd ref="39"/> - <nd ref="40"/> - <nd ref="41"/> - <nd ref="38"/> - </way> - <relation id="2" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> - <tag k="type" v="multipolygon"/> - <member type="way" ref="7" role=""/> - <member type="way" ref="8" role=""/> - </relation> - </create> - - <create> - <!-- relation (polygon with island and hole) --> - <node id="42" lat="10.0" lon="10.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="43" lat="10.6" lon="10.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="44" lat="10.6" lon="10.6" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="45" lat="10.0" lon="10.6" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <way id="9" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> - <tag k="type" v="polygon"/> - <nd ref="42"/> - <nd ref="43"/> - <nd ref="44"/> - <nd ref="45"/> - <nd ref="42"/> - </way> - <node id="46" lat="10.2" lon="10.2" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="47" lat="10.4" lon="10.2" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="48" lat="10.4" lon="10.4" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="49" lat="10.2" lon="10.4" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <way id="10" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> - <tag k="type" v="polygon"/> - <nd ref="46"/> - <nd ref="47"/> - <nd ref="48"/> - <nd ref="49"/> - <nd ref="46"/> - </way> - <node id="50" lat="10.8" lon="10.8" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="51" lat="11.0" lon="10.8" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="52" lat="11.0" lon="11.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="53" lat="10.8" lon="11.0" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <way id="11" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> - <tag k="type" v="polygon"/> - <nd ref="50"/> - <nd ref="51"/> - <nd ref="52"/> - <nd ref="53"/> - <nd ref="50"/> - </way> - <relation id="3" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> - <tag k="type" v="multipolygon"/> - <member type="way" ref="9" role=""/> - <member type="way" ref="10" role=""/> - <member type="way" ref="11" role=""/> - </relation> - </create> - <modify> - <!-- node (point) with id 0 --> - <node id="0" lat="0.5" lon="0.5" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> - <tag k="type" v="point"/> - <tag k="note" v="modified"/> - </node> - </modify> - - <modify> - <!-- way (line) with id 1 --> - <node id="1" lat="1.2" lon="1.2" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="2" lat="1.8" lon="1.8" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <way id="1" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> - <tag k="type" v="line"/> - <tag k="note" v="modified"/> - <nd ref="1"/> - <nd ref="2"/> - </way> - </modify> - - <modify> - <!-- way (polygon) with id 2 --> - <node id="7" lat="3.1" lon="3.1" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="8" lat="3.9" lon="3.1" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="9" lat="3.9" lon="3.9" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="10" lat="3.1" lon="3.9" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <way id="3" version="1" changeset="2" user="user" uid="2" visible="true" timestamp="2000-01-01T00:00:00Z"> - <tag k="type" v="polygon"/> - <tag k="note" v="modified"/> - <nd ref="7"/> - <nd ref="8"/> - <nd ref="9"/> - <nd ref="10"/> - <nd ref="7"/> - </way> - <node id="11" lat="3.2" lon="3.2" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="12" lat="3.8" lon="3.2" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="13" lat="3.8" lon="3.8" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <node id="14" lat="3.2" lon="3.8" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"/> - <way id="4" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> - <tag k="type" v="polygon"/> - <tag k="note" v="modified"/> - <nd ref="11"/> - <nd ref="12"/> - <nd ref="13"/> - <nd ref="14"/> - <nd ref="11"/> - </way> - <relation id="1" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z"> - <tag k="type" v="multipolygon"/> - <tag k="note" v="modified"/> - <member type="way" ref="3" role=""/> - <member type="way" ref="4" role=""/> - </relation> - </modify> - - <delete> - <!-- relation (polygon with island and hole) with id 2 --> - <relation id="2" version="1" changeset="2" user="user" uid="1" visible="true" timestamp="2000-01-01T00:00:00Z" /> - </delete> -</osmChange> \ No newline at end of file diff --git a/baremaps-core/src/test/resources/samples/sample.osm.pbf b/baremaps-core/src/test/resources/samples/sample.osm.pbf deleted file mode 100644 index ec0cb090..00000000 Binary files a/baremaps-core/src/test/resources/samples/sample.osm.pbf and /dev/null differ
