diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/osm/OsmElement.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/osm/OsmElement.java index 8d2d89c9..8bb42e99 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/osm/OsmElement.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/osm/OsmElement.java @@ -235,4 +235,13 @@ public interface OsmElement extends WithTags { record Info(long changeset, long timestamp, int userId, int version, String user) { private static final int COST = 2; } + + static long vectorTileFeatureId(int multiplier, long id, Type type) { + return (id * multiplier) + switch (type) { + case OTHER -> 0; + case NODE -> 1; + case WAY -> 2; + case RELATION -> 3; + }; + } } diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/osm/OsmReader.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/osm/OsmReader.java index de4eabf7..48aaa573 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/osm/OsmReader.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/osm/OsmReader.java @@ -646,12 +646,7 @@ public class OsmReader implements Closeable, MemoryEstimator.HasEstimate { @Override public long vectorTileFeatureId(int multiplier) { - return (id() * multiplier) + switch (originalElement.type()) { - case OTHER -> 0; - case NODE -> 1; - case WAY -> 2; - case RELATION -> 3; - }; + return OsmElement.vectorTileFeatureId(multiplier, id(), originalElement.type()); } @Override diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/osm/OsmRelationInfo.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/osm/OsmRelationInfo.java index 5b0d0f1f..c8fe5839 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/osm/OsmRelationInfo.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/osm/OsmRelationInfo.java @@ -15,4 +15,8 @@ public interface OsmRelationInfo extends MemoryEstimator.HasEstimate { default long estimateMemoryUsageBytes() { return 0; } + + default long vectorTileFeatureId(int multiplier) { + return OsmElement.vectorTileFeatureId(multiplier, id(), OsmElement.Type.RELATION); + } }