From c89629cf970958cf88ee4a2cf637e29ce6291a66 Mon Sep 17 00:00:00 2001 From: Mike Barry Date: Sun, 16 Jun 2024 07:23:35 -0400 Subject: [PATCH] Address warnings and deprecations --- src/main/java/org/openmaptiles/Generate.java | 6 +++--- .../org/openmaptiles/OpenMapTilesProfile.java | 21 ++++++++----------- .../org/openmaptiles/layers/Boundary.java | 7 ++++--- .../org/openmaptiles/layers/Building.java | 6 +++--- .../org/openmaptiles/layers/Housenumber.java | 10 ++++----- .../org/openmaptiles/layers/Landcover.java | 7 ++++--- .../java/org/openmaptiles/layers/Landuse.java | 5 +++-- .../org/openmaptiles/layers/MountainPeak.java | 9 ++++---- .../java/org/openmaptiles/layers/Park.java | 11 +++------- .../java/org/openmaptiles/layers/Place.java | 7 ++++--- .../java/org/openmaptiles/layers/Poi.java | 8 +++---- .../openmaptiles/layers/Transportation.java | 11 +++++----- .../layers/TransportationName.java | 6 +++--- .../java/org/openmaptiles/layers/Water.java | 4 ++-- .../org/openmaptiles/layers/Waterway.java | 7 ++++--- 15 files changed, 62 insertions(+), 63 deletions(-) diff --git a/src/main/java/org/openmaptiles/Generate.java b/src/main/java/org/openmaptiles/Generate.java index 69782ffd..7cde2194 100644 --- a/src/main/java/org/openmaptiles/Generate.java +++ b/src/main/java/org/openmaptiles/Generate.java @@ -604,16 +604,16 @@ private static List parseTableFields(Imposm3Table tableDefinition * "class") based on the "field mapping" defined in the layer schema definition. */ static MultiExpression generateFieldMapping(JsonNode valuesNode) { - MultiExpression mapping = MultiExpression.of(new ArrayList<>()); + List> mappings = new ArrayList<>(); valuesNode.fields().forEachRemaining(entry -> { String field = entry.getKey(); JsonNode node = entry.getValue(); Expression expression = or(parseFieldMappingExpression(node).toList()).simplify(); if (!expression.equals(or()) && !expression.equals(and())) { - mapping.expressions().add(MultiExpression.entry(field, expression)); + mappings.add(MultiExpression.entry(field, expression)); } }); - return mapping; + return MultiExpression.of(mappings); } private static Stream parseFieldMappingExpression(JsonNode node) { diff --git a/src/main/java/org/openmaptiles/OpenMapTilesProfile.java b/src/main/java/org/openmaptiles/OpenMapTilesProfile.java index d5d992fc..3c51afa5 100644 --- a/src/main/java/org/openmaptiles/OpenMapTilesProfile.java +++ b/src/main/java/org/openmaptiles/OpenMapTilesProfile.java @@ -41,7 +41,7 @@ * * Layers can also subscribe to notifications when we finished processing an input source by implementing * {@link FinishHandler} or post-process features in that layer before rendering the output tile by implementing - * {@link FeaturePostProcessor}. + * {@link LayerPostProcesser}. */ public class OpenMapTilesProfile extends ForwardingProfile { @@ -133,7 +133,7 @@ public OpenMapTilesProfile(Translations translations, PlanetilerConfig config, S registerSourceHandler(OSM_SOURCE, (source, features) -> { for (var match : getTableMatches(source)) { RowDispatch rowDispatch = match.match(); - var row = rowDispatch.constructor.create(source, match.keys().get(0)); + var row = rowDispatch.constructor.create(source, match.keys().getFirst()); for (Tables.RowHandler handler : rowDispatch.handlers()) { handler.process(row, features); } @@ -143,23 +143,20 @@ public OpenMapTilesProfile(Translations translations, PlanetilerConfig config, S } /** Returns the imposm3 table row constructors that match an input element's tags. */ - public List> getTableMatches(SourceFeature input) { + private List> getTableMatches(SourceFeature input) { return osmMappings.getMatchesWithTriggers(input); } @Override public boolean caresAboutWikidataTranslation(OsmElement elem) { var tags = elem.tags(); - if (elem instanceof OsmElement.Node) { - return wikidataMappings.getOrElse(SimpleFeature.create(EMPTY_POINT, tags), false); - } else if (elem instanceof OsmElement.Way) { - return wikidataMappings.getOrElse(SimpleFeature.create(EMPTY_POLYGON, tags), false) || + return switch (elem) { + case OsmElement.Node ignored -> wikidataMappings.getOrElse(SimpleFeature.create(EMPTY_POINT, tags), false); + case OsmElement.Way ignored -> wikidataMappings.getOrElse(SimpleFeature.create(EMPTY_POLYGON, tags), false) || wikidataMappings.getOrElse(SimpleFeature.create(EMPTY_LINE, tags), false); - } else if (elem instanceof OsmElement.Relation) { - return wikidataMappings.getOrElse(SimpleFeature.create(EMPTY_POLYGON, tags), false); - } else { - return false; - } + case OsmElement.Relation ignored -> wikidataMappings.getOrElse(SimpleFeature.create(EMPTY_POLYGON, tags), false); + default -> false; + }; } /* diff --git a/src/main/java/org/openmaptiles/layers/Boundary.java b/src/main/java/org/openmaptiles/layers/Boundary.java index 2f72e4fe..01fb3e98 100644 --- a/src/main/java/org/openmaptiles/layers/Boundary.java +++ b/src/main/java/org/openmaptiles/layers/Boundary.java @@ -44,6 +44,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE import com.carrotsearch.hppc.LongObjectMap; import com.onthegomap.planetiler.FeatureCollector; import com.onthegomap.planetiler.FeatureMerge; +import com.onthegomap.planetiler.ForwardingProfile; import com.onthegomap.planetiler.VectorTile; import com.onthegomap.planetiler.collection.Hppc; import com.onthegomap.planetiler.config.PlanetilerConfig; @@ -95,11 +96,11 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE public class Boundary implements OpenMapTilesSchema.Boundary, OpenMapTilesProfile.NaturalEarthProcessor, - OpenMapTilesProfile.OsmRelationPreprocessor, + ForwardingProfile.OsmRelationPreprocessor, OpenMapTilesProfile.OsmAllProcessor, Tables.OsmBoundaryPolygon.Handler, - OpenMapTilesProfile.FeaturePostProcessor, - OpenMapTilesProfile.FinishHandler { + ForwardingProfile.LayerPostProcesser, + ForwardingProfile.FinishHandler { /* * Uses natural earth at lower zoom levels and OpenStreetMap at higher zoom levels. diff --git a/src/main/java/org/openmaptiles/layers/Building.java b/src/main/java/org/openmaptiles/layers/Building.java index c1a1a3dc..bd38eca8 100644 --- a/src/main/java/org/openmaptiles/layers/Building.java +++ b/src/main/java/org/openmaptiles/layers/Building.java @@ -42,6 +42,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE import com.onthegomap.planetiler.FeatureCollector; import com.onthegomap.planetiler.FeatureMerge; +import com.onthegomap.planetiler.ForwardingProfile; import com.onthegomap.planetiler.VectorTile; import com.onthegomap.planetiler.config.PlanetilerConfig; import com.onthegomap.planetiler.geo.GeometryException; @@ -53,7 +54,6 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE import java.util.List; import java.util.Locale; import java.util.Map; -import org.openmaptiles.OpenMapTilesProfile; import org.openmaptiles.generated.OpenMapTilesSchema; import org.openmaptiles.generated.Tables; @@ -67,8 +67,8 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE public class Building implements OpenMapTilesSchema.Building, Tables.OsmBuildingPolygon.Handler, - OpenMapTilesProfile.FeaturePostProcessor, - OpenMapTilesProfile.OsmRelationPreprocessor { + ForwardingProfile.LayerPostProcesser, + ForwardingProfile.OsmRelationPreprocessor { /* * Emit all buildings from OSM data at z14. diff --git a/src/main/java/org/openmaptiles/layers/Housenumber.java b/src/main/java/org/openmaptiles/layers/Housenumber.java index 8a0bddd5..63b3c4ba 100644 --- a/src/main/java/org/openmaptiles/layers/Housenumber.java +++ b/src/main/java/org/openmaptiles/layers/Housenumber.java @@ -66,7 +66,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE public class Housenumber implements OpenMapTilesSchema.Housenumber, Tables.OsmHousenumberPoint.Handler, - ForwardingProfile.FeaturePostProcessor { + ForwardingProfile.LayerPostProcesser { private static final Logger LOGGER = LoggerFactory.getLogger(Housenumber.class); private static final String OSM_SEPARATOR = ";"; @@ -75,7 +75,7 @@ public class Housenumber implements private static final String TEMP_PARTITION = "_partition"; private static final String TEMP_HAS_NAME = "_has_name"; private static final Comparator BY_TEMP_HAS_NAME = Comparator - .comparing(i -> (Boolean) i.attrs().get(TEMP_HAS_NAME), Boolean::compare); + .comparing(i -> (Boolean) i.tags().get(TEMP_HAS_NAME), Boolean::compare); private final Stats stats; public Housenumber(Translations translations, PlanetilerConfig config, Stats stats) { @@ -144,7 +144,7 @@ public void process(Tables.OsmHousenumberPoint element, FeatureCollector feature public List postProcess(int zoom, List list) throws GeometryException { // remove duplicate house numbers, features without name tag are prioritized var items = list.stream() - .collect(Collectors.groupingBy(f -> f.attrs().get(TEMP_PARTITION))) + .collect(Collectors.groupingBy(f -> f.tags().get(TEMP_PARTITION))) .values().stream() .flatMap( g -> g.stream().min(BY_TEMP_HAS_NAME).stream() @@ -153,8 +153,8 @@ public List postProcess(int zoom, List l // remove temporary attributes for (var item : items) { - item.attrs().remove(TEMP_HAS_NAME); - item.attrs().remove(TEMP_PARTITION); + item.tags().remove(TEMP_HAS_NAME); + item.tags().remove(TEMP_PARTITION); } // reduces the size of some heavy z14 tiles with many repeated housenumber values by 60% or more diff --git a/src/main/java/org/openmaptiles/layers/Landcover.java b/src/main/java/org/openmaptiles/layers/Landcover.java index 43a5b647..0039d6c6 100644 --- a/src/main/java/org/openmaptiles/layers/Landcover.java +++ b/src/main/java/org/openmaptiles/layers/Landcover.java @@ -37,6 +37,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE import com.onthegomap.planetiler.FeatureCollector; import com.onthegomap.planetiler.FeatureMerge; +import com.onthegomap.planetiler.ForwardingProfile; import com.onthegomap.planetiler.VectorTile; import com.onthegomap.planetiler.config.PlanetilerConfig; import com.onthegomap.planetiler.expression.MultiExpression; @@ -65,7 +66,7 @@ public class Landcover implements OpenMapTilesSchema.Landcover, OpenMapTilesProfile.NaturalEarthProcessor, Tables.OsmLandcoverPolygon.Handler, - OpenMapTilesProfile.FeaturePostProcessor { + ForwardingProfile.LayerPostProcesser { /* * Large ice areas come from natural earth and the rest come from OpenStreetMap at higher zoom @@ -138,7 +139,7 @@ public void process(Tables.OsmLandcoverPolygon element, FeatureCollector feature public List postProcess(int zoom, List items) throws GeometryException { if (zoom < 7 || zoom > 13) { for (var item : items) { - item.attrs().remove(TEMP_NUM_POINTS_ATTR); + item.tags().remove(TEMP_NUM_POINTS_ATTR); } return items; } else { // z7-13 @@ -176,7 +177,7 @@ public List postProcess(int zoom, List i } var merged = FeatureMerge.mergeOverlappingPolygons(toMerge, 4); for (var item : merged) { - item.attrs().remove(tempGroupKey); + item.tags().remove(tempGroupKey); } result.addAll(merged); return result; diff --git a/src/main/java/org/openmaptiles/layers/Landuse.java b/src/main/java/org/openmaptiles/layers/Landuse.java index 1faeb60f..fef52c54 100644 --- a/src/main/java/org/openmaptiles/layers/Landuse.java +++ b/src/main/java/org/openmaptiles/layers/Landuse.java @@ -40,6 +40,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE import com.onthegomap.planetiler.FeatureCollector; import com.onthegomap.planetiler.FeatureMerge; +import com.onthegomap.planetiler.ForwardingProfile; import com.onthegomap.planetiler.VectorTile; import com.onthegomap.planetiler.config.PlanetilerConfig; import com.onthegomap.planetiler.geo.GeometryException; @@ -67,7 +68,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE public class Landuse implements OpenMapTilesSchema.Landuse, OpenMapTilesProfile.NaturalEarthProcessor, - OpenMapTilesProfile.FeaturePostProcessor, + ForwardingProfile.LayerPostProcesser, Tables.OsmLandusePolygon.Handler { private static final ZoomFunction MIN_PIXEL_SIZE_THRESHOLDS = ZoomFunction.fromMaxZoomThresholds(Map.of( @@ -137,7 +138,7 @@ public List postProcess(int zoom, List toMerge = new ArrayList<>(); List result = new ArrayList<>(); for (var item : items) { - if (FieldValues.CLASS_RESIDENTIAL.equals(item.attrs().get(Fields.CLASS))) { + if (FieldValues.CLASS_RESIDENTIAL.equals(item.tags().get(Fields.CLASS))) { toMerge.add(item); } else { result.add(item); diff --git a/src/main/java/org/openmaptiles/layers/MountainPeak.java b/src/main/java/org/openmaptiles/layers/MountainPeak.java index afb32bbf..85fe8ace 100644 --- a/src/main/java/org/openmaptiles/layers/MountainPeak.java +++ b/src/main/java/org/openmaptiles/layers/MountainPeak.java @@ -40,6 +40,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE import com.carrotsearch.hppc.LongIntMap; import com.onthegomap.planetiler.FeatureCollector; +import com.onthegomap.planetiler.ForwardingProfile; import com.onthegomap.planetiler.VectorTile; import com.onthegomap.planetiler.collection.Hppc; import com.onthegomap.planetiler.config.PlanetilerConfig; @@ -74,7 +75,7 @@ public class MountainPeak implements OpenMapTilesSchema.MountainPeak, Tables.OsmPeakPoint.Handler, Tables.OsmMountainLinestring.Handler, - OpenMapTilesProfile.FeaturePostProcessor { + ForwardingProfile.LayerPostProcesser { /* * Mountain peaks come from OpenStreetMap data and are ranked by importance (based on if they @@ -180,8 +181,8 @@ public List postProcess(int zoom, List i // now that we have accurate ranks, remove anything outside the desired buffer if (!insideTileBuffer(feature)) { items.set(i, null); - } else if (!feature.attrs().containsKey(Fields.RANK)) { - feature.attrs().put(Fields.RANK, gridrank); + } else if (!feature.tags().containsKey(Fields.RANK)) { + feature.tags().put(Fields.RANK, gridrank); } } return items; @@ -196,7 +197,7 @@ private boolean insideTileBuffer(VectorTile.Feature feature) { Geometry geom = feature.geometry().decode(); return !(geom instanceof Point point) || (insideTileBuffer(point.getX()) && insideTileBuffer(point.getY())); } catch (GeometryException e) { - e.log(stats, "mountain_peak_decode_point", "Error decoding mountain peak point: " + feature.attrs()); + e.log(stats, "mountain_peak_decode_point", "Error decoding mountain peak point: " + feature.tags()); return false; } } diff --git a/src/main/java/org/openmaptiles/layers/Park.java b/src/main/java/org/openmaptiles/layers/Park.java index 438745fb..aa18fb8d 100644 --- a/src/main/java/org/openmaptiles/layers/Park.java +++ b/src/main/java/org/openmaptiles/layers/Park.java @@ -42,6 +42,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE import com.carrotsearch.hppc.LongIntMap; import com.onthegomap.planetiler.FeatureCollector; import com.onthegomap.planetiler.FeatureMerge; +import com.onthegomap.planetiler.ForwardingProfile; import com.onthegomap.planetiler.VectorTile; import com.onthegomap.planetiler.collection.Hppc; import com.onthegomap.planetiler.config.PlanetilerConfig; @@ -53,7 +54,6 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE import com.onthegomap.planetiler.util.Translations; import java.util.List; import java.util.Locale; -import org.openmaptiles.OpenMapTilesProfile; import org.openmaptiles.generated.OpenMapTilesSchema; import org.openmaptiles.generated.Tables; import org.openmaptiles.util.OmtLanguageUtils; @@ -68,17 +68,12 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE public class Park implements OpenMapTilesSchema.Park, Tables.OsmParkPolygon.Handler, - OpenMapTilesProfile.FeaturePostProcessor { - - // constants for packing the minimum zoom ordering of park labels into the sort-key field - private static final int PARK_NATIONAL_PARK_BOOST = 1 << (SORT_KEY_BITS - 1); - private static final int PARK_WIKIPEDIA_BOOST = 1 << (SORT_KEY_BITS - 2); + ForwardingProfile.LayerPostProcesser { // constants for determining the minimum zoom level for a park label based on its area private static final double WORLD_AREA_FOR_70K_SQUARE_METERS = Math.pow(GeoUtils.metersToPixelAtEquator(0, Math.sqrt(70_000)) / 256d, 2); private static final double LOG2 = Math.log(2); - private static final int PARK_AREA_RANGE = 1 << (SORT_KEY_BITS - 3); private static final double SMALLEST_PARK_WORLD_AREA = Math.pow(4, -26); // 2^14 tiles, 2^12 pixels per tile private final Translations translations; @@ -149,7 +144,7 @@ public List postProcess(int zoom, List i for (VectorTile.Feature feature : items) { if (feature.geometry().geomType() == GeometryType.POINT && feature.hasGroup()) { int count = counts.getOrDefault(feature.group(), 0) + 1; - feature.attrs().put("rank", count); + feature.tags().put("rank", count); counts.put(feature.group(), count); } } diff --git a/src/main/java/org/openmaptiles/layers/Place.java b/src/main/java/org/openmaptiles/layers/Place.java index 19e84942..598c0f6a 100644 --- a/src/main/java/org/openmaptiles/layers/Place.java +++ b/src/main/java/org/openmaptiles/layers/Place.java @@ -42,6 +42,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE import com.carrotsearch.hppc.LongIntMap; import com.onthegomap.planetiler.FeatureCollector; +import com.onthegomap.planetiler.ForwardingProfile; import com.onthegomap.planetiler.VectorTile; import com.onthegomap.planetiler.collection.Hppc; import com.onthegomap.planetiler.config.PlanetilerConfig; @@ -89,7 +90,7 @@ public class Place implements Tables.OsmIslandPolygon.Handler, Tables.OsmCityPoint.Handler, Tables.OsmBoundaryPolygon.Handler, - OpenMapTilesProfile.FeaturePostProcessor { + ForwardingProfile.LayerPostProcesser { /* * Place labels locations and names come from OpenStreetMap, but we also join with natural @@ -396,8 +397,8 @@ public List postProcess(int zoom, List i for (VectorTile.Feature feature : items) { int gridrank = groupCounts.getOrDefault(feature.group(), 1); groupCounts.put(feature.group(), gridrank + 1); - if (!feature.attrs().containsKey(Fields.RANK)) { - feature.attrs().put(Fields.RANK, 10 + gridrank); + if (!feature.tags().containsKey(Fields.RANK)) { + feature.tags().put(Fields.RANK, 10 + gridrank); } } return items; diff --git a/src/main/java/org/openmaptiles/layers/Poi.java b/src/main/java/org/openmaptiles/layers/Poi.java index 22736837..ea963611 100644 --- a/src/main/java/org/openmaptiles/layers/Poi.java +++ b/src/main/java/org/openmaptiles/layers/Poi.java @@ -80,8 +80,8 @@ public class Poi implements OpenMapTilesSchema.Poi, Tables.OsmPoiPoint.Handler, Tables.OsmPoiPolygon.Handler, - ForwardingProfile.FeaturePostProcessor, - OpenMapTilesProfile.FinishHandler { + ForwardingProfile.LayerPostProcesser, + ForwardingProfile.FinishHandler { /* * process() creates the raw POI feature from OSM elements and postProcess() @@ -331,8 +331,8 @@ public List postProcess(int zoom, List i for (VectorTile.Feature feature : items) { int gridrank = groupCounts.getOrDefault(feature.group(), 1); groupCounts.put(feature.group(), gridrank + 1); - if (!feature.attrs().containsKey(Fields.RANK)) { - feature.attrs().put(Fields.RANK, gridrank); + if (!feature.tags().containsKey(Fields.RANK)) { + feature.tags().put(Fields.RANK, gridrank); } } return items; diff --git a/src/main/java/org/openmaptiles/layers/Transportation.java b/src/main/java/org/openmaptiles/layers/Transportation.java index 17f17e2a..4584ae61 100644 --- a/src/main/java/org/openmaptiles/layers/Transportation.java +++ b/src/main/java/org/openmaptiles/layers/Transportation.java @@ -43,6 +43,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE import com.onthegomap.planetiler.FeatureCollector; import com.onthegomap.planetiler.FeatureMerge; +import com.onthegomap.planetiler.ForwardingProfile; import com.onthegomap.planetiler.VectorTile; import com.onthegomap.planetiler.config.PlanetilerConfig; import com.onthegomap.planetiler.expression.MultiExpression; @@ -93,8 +94,8 @@ public class Transportation implements Tables.OsmShipwayLinestring.Handler, Tables.OsmHighwayPolygon.Handler, OpenMapTilesProfile.NaturalEarthProcessor, - OpenMapTilesProfile.FeaturePostProcessor, - OpenMapTilesProfile.OsmRelationPreprocessor, + ForwardingProfile.LayerPostProcesser, + ForwardingProfile.OsmRelationPreprocessor, OpenMapTilesProfile.IgnoreWikidata { /* @@ -676,16 +677,16 @@ public List postProcess(int zoom, List i // TODO merge preserving oneway instead ignoring int onewayId = 1; for (var item : items) { - var oneway = item.attrs().get(Fields.ONEWAY); + var oneway = item.tags().get(Fields.ONEWAY); if (oneway instanceof Number n && ONEWAY_VALUES.contains(n.intValue())) { - item.attrs().put(LIMIT_MERGE_TAG, onewayId++); + item.tags().put(LIMIT_MERGE_TAG, onewayId++); } } var merged = FeatureMerge.mergeLineStrings(items, minLength, tolerance, BUFFER_SIZE); for (var item : merged) { - item.attrs().remove(LIMIT_MERGE_TAG); + item.tags().remove(LIMIT_MERGE_TAG); } return merged; } diff --git a/src/main/java/org/openmaptiles/layers/TransportationName.java b/src/main/java/org/openmaptiles/layers/TransportationName.java index 2525f52c..6184b9e2 100644 --- a/src/main/java/org/openmaptiles/layers/TransportationName.java +++ b/src/main/java/org/openmaptiles/layers/TransportationName.java @@ -81,7 +81,7 @@ public class TransportationName implements Tables.OsmHighwayLinestring.Handler, Tables.OsmAerialwayLinestring.Handler, Tables.OsmShipwayLinestring.Handler, - OpenMapTilesProfile.FeaturePostProcessor, + ForwardingProfile.LayerPostProcesser, OpenMapTilesProfile.IgnoreWikidata, ForwardingProfile.OsmNodePreprocessor, ForwardingProfile.OsmWayPreprocessor { @@ -357,8 +357,8 @@ public List postProcess(int zoom, List i if (limitMerge) { // remove temp keys that were just used to improve line merging for (var feature : result) { - feature.attrs().remove(LINK_TEMP_KEY); - feature.attrs().remove(RELATION_ID_TEMP_KEY); + feature.tags().remove(LINK_TEMP_KEY); + feature.tags().remove(RELATION_ID_TEMP_KEY); } } return result; diff --git a/src/main/java/org/openmaptiles/layers/Water.java b/src/main/java/org/openmaptiles/layers/Water.java index e3683a1a..0f7f88c2 100644 --- a/src/main/java/org/openmaptiles/layers/Water.java +++ b/src/main/java/org/openmaptiles/layers/Water.java @@ -72,8 +72,8 @@ public class Water implements Tables.OsmWaterPolygon.Handler, OpenMapTilesProfile.NaturalEarthProcessor, OpenMapTilesProfile.OsmWaterPolygonProcessor, - ForwardingProfile.FeaturePostProcessor, - OpenMapTilesProfile.FinishHandler { + ForwardingProfile.LayerPostProcesser, + ForwardingProfile.FinishHandler { /* * At low zoom levels, use natural earth for oceans and major lakes, and at high zoom levels diff --git a/src/main/java/org/openmaptiles/layers/Waterway.java b/src/main/java/org/openmaptiles/layers/Waterway.java index 64d749a4..b5ac3e62 100644 --- a/src/main/java/org/openmaptiles/layers/Waterway.java +++ b/src/main/java/org/openmaptiles/layers/Waterway.java @@ -41,6 +41,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE import com.google.common.util.concurrent.AtomicDouble; import com.onthegomap.planetiler.FeatureCollector; import com.onthegomap.planetiler.FeatureMerge; +import com.onthegomap.planetiler.ForwardingProfile; import com.onthegomap.planetiler.VectorTile; import com.onthegomap.planetiler.collection.Hppc; import com.onthegomap.planetiler.config.PlanetilerConfig; @@ -70,9 +71,9 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE public class Waterway implements OpenMapTilesSchema.Waterway, Tables.OsmWaterwayLinestring.Handler, - OpenMapTilesProfile.FeaturePostProcessor, + ForwardingProfile.LayerPostProcesser, OpenMapTilesProfile.NaturalEarthProcessor, - OpenMapTilesProfile.OsmRelationPreprocessor, + ForwardingProfile.OsmRelationPreprocessor, OpenMapTilesProfile.OsmAllProcessor { /* @@ -207,7 +208,7 @@ public List postProcess(int zoom, List i // remove ways for river relations if relation is not long enough double minSizeAtZoom = MIN_PIXEL_LENGTHS.apply(zoom).doubleValue() / Math.pow(2, zoom) / 256d; for (int i = 0; i < items.size(); i++) { - Object relIdObj = items.get(i).attrs().remove(TEMP_REL_ID_ADDR); + Object relIdObj = items.get(i).tags().remove(TEMP_REL_ID_ADDR); if (relIdObj instanceof Long relId && riverRelationLengths.get(relId).get() < minSizeAtZoom) { items.set(i, null); }