From ebd91e13208862a2bf163102f85b9229187b71d5 Mon Sep 17 00:00:00 2001 From: Mike Barry Date: Sun, 17 Sep 2023 07:12:42 -0400 Subject: [PATCH] fix tests --- .../onthegomap/planetiler/archive/TileArchiveWriter.java | 6 +++--- .../planetiler/util/TilesetSummaryStatistics.java | 7 ++++--- .../util/{OsmTileStats.java => TopOsmTiles.java} | 4 ++-- .../src/main/java/com/onthegomap/planetiler/Main.java | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-) rename planetiler-core/src/main/java/com/onthegomap/planetiler/util/{OsmTileStats.java => TopOsmTiles.java} (97%) diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/archive/TileArchiveWriter.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/archive/TileArchiveWriter.java index 63c30a1815..e87441e6a5 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/archive/TileArchiveWriter.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/archive/TileArchiveWriter.java @@ -307,12 +307,12 @@ private void tileEncoderSink(Iterable prev) throws IOException { } lastTileDataHash = tileDataHash; } - if ((skipFilled && lastIsFill) || encoded == null) { + if ((skipFilled && lastIsFill) || bytes == null) { continue; } - tileStatsUpdater.recordTile(tileFeatures.tileCoord(), encoded.length, layerStats); + tileStatsUpdater.recordTile(tileFeatures.tileCoord(), bytes.length, layerStats); List layerStatsRows = config.outputLayerStats() ? - TileSizeStats.formatOutputRows(tileFeatures.tileCoord(), encoded.length, layerStats) : + TileSizeStats.formatOutputRows(tileFeatures.tileCoord(), bytes.length, layerStats) : List.of(); result.add( new TileEncodingResult( diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/util/TilesetSummaryStatistics.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/util/TilesetSummaryStatistics.java index a91f35fcb7..c7724e7989 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/util/TilesetSummaryStatistics.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/util/TilesetSummaryStatistics.java @@ -28,11 +28,12 @@ public Summary summary() { public void printStats(String debugUrlPattern) { if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Tile stats:"); Summary result = summary(); var overallStats = result.get(); var formatter = Format.defaultInstance(); var biggestTiles = overallStats.biggestTiles(); - LOGGER.debug("Biggest tiles (gzipped):\n{}", + LOGGER.debug("Biggest tiles (gzipped)\n{}", IntStream.range(0, biggestTiles.size()) .mapToObj(index -> { var tile = biggestTiles.get(index); @@ -53,7 +54,7 @@ public void printStats(String debugUrlPattern) { .filter(tile -> !alreadyListed.contains(tile.coord) && tile.size > WARN_BYTES) .toList(); if (!otherTiles.isEmpty()) { - LOGGER.info("Other tiles with large layers:\n{}", + LOGGER.info("Other tiles with large layers\n{}", otherTiles.stream() .map(tile -> "%d/%d/%d (%s) %s (%s)".formatted( tile.coord.z(), @@ -65,7 +66,7 @@ public void printStats(String debugUrlPattern) { )).collect(Collectors.joining("\n"))); } - LOGGER.debug("Max tile sizes:\n{}\n{}\n{}", + LOGGER.debug("Max tile sizes\n{}\n{}\n{}", writeStatsTable(result, n -> { String string = " " + formatter.storage(n, true); return n.intValue() > ERROR_BYTES ? AnsiColors.red(string) : diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/util/OsmTileStats.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/util/TopOsmTiles.java similarity index 97% rename from planetiler-core/src/main/java/com/onthegomap/planetiler/util/OsmTileStats.java rename to planetiler-core/src/main/java/com/onthegomap/planetiler/util/TopOsmTiles.java index 0b4f915412..f47fe57e61 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/util/OsmTileStats.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/util/TopOsmTiles.java @@ -32,8 +32,8 @@ import org.slf4j.LoggerFactory; import org.tukaani.xz.XZInputStream; -public class OsmTileStats { - private static final Logger LOGGER = LoggerFactory.getLogger(OsmTileStats.class); +public class TopOsmTiles { + private static final Logger LOGGER = LoggerFactory.getLogger(TopOsmTiles.class); public static void main(String[] args) { Arguments arguments = Arguments.fromArgsOrConfigFile(args); diff --git a/planetiler-dist/src/main/java/com/onthegomap/planetiler/Main.java b/planetiler-dist/src/main/java/com/onthegomap/planetiler/Main.java index 68e83be163..3a8fcf2732 100644 --- a/planetiler-dist/src/main/java/com/onthegomap/planetiler/Main.java +++ b/planetiler-dist/src/main/java/com/onthegomap/planetiler/Main.java @@ -11,8 +11,8 @@ import com.onthegomap.planetiler.examples.ToiletsOverlay; import com.onthegomap.planetiler.examples.ToiletsOverlayLowLevelApi; import com.onthegomap.planetiler.mbtiles.Verify; -import com.onthegomap.planetiler.util.OsmTileStats; import com.onthegomap.planetiler.util.TileSizeStats; +import com.onthegomap.planetiler.util.TopOsmTiles; import java.util.Arrays; import java.util.Locale; import java.util.Map; @@ -54,7 +54,7 @@ public class Main { entry("verify-mbtiles", Verify::main), entry("verify-monaco", VerifyMonaco::main), entry("stats", TileSizeStats::main), - entry("top-osm-tiles", OsmTileStats::main) + entry("top-osm-tiles", TopOsmTiles::main) ); private static EntryPoint bundledSchema(String path) {