Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
msbarry committed Sep 17, 2023
1 parent a64d4db commit ebd91e1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,12 @@ private void tileEncoderSink(Iterable<TileBatch> 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<String> layerStatsRows = config.outputLayerStats() ?
TileSizeStats.formatOutputRows(tileFeatures.tileCoord(), encoded.length, layerStats) :
TileSizeStats.formatOutputRows(tileFeatures.tileCoord(), bytes.length, layerStats) :
List.of();
result.add(
new TileEncodingResult(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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(),
Expand All @@ -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) :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit ebd91e1

Please sign in to comment.