mirror of
https://github.com/cfpwastaken/planetiler-openmaptiles.git
synced 2026-02-04 12:31:10 +00:00
Optimize tile sizes (#112)
This commit is contained in:
@@ -8,6 +8,7 @@ import static org.junit.jupiter.api.DynamicTest.dynamicTest;
|
||||
|
||||
import com.onthegomap.planetiler.TestUtils;
|
||||
import com.onthegomap.planetiler.VectorTile;
|
||||
import com.onthegomap.planetiler.archive.Tile;
|
||||
import com.onthegomap.planetiler.config.Arguments;
|
||||
import com.onthegomap.planetiler.mbtiles.Mbtiles;
|
||||
import com.onthegomap.planetiler.util.FileUtils;
|
||||
@@ -91,7 +92,7 @@ class OpenMapTilesTest {
|
||||
|
||||
@Test
|
||||
void ensureValidGeometries() throws Exception {
|
||||
Set<Mbtiles.TileEntry> parsedTiles = TestUtils.getAllTiles(mbtiles);
|
||||
Set<Tile> parsedTiles = TestUtils.getTiles(mbtiles);
|
||||
for (var tileEntry : parsedTiles) {
|
||||
var decoded = VectorTile.decode(gunzip(tileEntry.bytes()));
|
||||
for (VectorTile.Feature feature : decoded) {
|
||||
|
||||
@@ -143,13 +143,24 @@ class BuildingTest extends AbstractLayerTest {
|
||||
);
|
||||
|
||||
Assertions.assertEquals(
|
||||
2,
|
||||
1, // merged into 1 multipolygon
|
||||
profile.postProcessLayerFeatures(Building.LAYER_NAME, 14, List.of(poly1, poly2)).size()
|
||||
);
|
||||
|
||||
Assertions.assertEquals(
|
||||
2, // merged into 1 multipolygon
|
||||
profile.postProcessLayerFeatures(Building.LAYER_NAME, 14, List.of(poly1, poly2)).get(0).geometry().decode()
|
||||
.getNumGeometries()
|
||||
);
|
||||
Assertions.assertEquals(
|
||||
1,
|
||||
profile.postProcessLayerFeatures(Building.LAYER_NAME, 13, List.of(poly1, poly2)).size()
|
||||
);
|
||||
Assertions.assertEquals(
|
||||
1,
|
||||
profile.postProcessLayerFeatures(Building.LAYER_NAME, 13, List.of(poly1, poly2)).get(0).geometry().decode()
|
||||
.getNumGeometries()
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -120,12 +120,26 @@ class LanduseTest extends AbstractLayerTest {
|
||||
);
|
||||
|
||||
Assertions.assertEquals(
|
||||
3,
|
||||
profile.postProcessLayerFeatures(Landuse.LAYER_NAME, 13, List.of(poly1, poly2, poly3)).size()
|
||||
List.of(1, 2),
|
||||
profile.postProcessLayerFeatures(Landuse.LAYER_NAME, 13, List.of(poly1, poly2, poly3)).stream()
|
||||
.map(d -> {
|
||||
try {
|
||||
return d.geometry().decode().getNumGeometries();
|
||||
} catch (GeometryException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}).toList()
|
||||
);
|
||||
Assertions.assertEquals(
|
||||
2,
|
||||
profile.postProcessLayerFeatures(Landuse.LAYER_NAME, 12, List.of(poly1, poly2, poly3)).size()
|
||||
List.of(1, 1),
|
||||
profile.postProcessLayerFeatures(Landuse.LAYER_NAME, 12, List.of(poly1, poly2, poly3)).stream()
|
||||
.map(d -> {
|
||||
try {
|
||||
return d.geometry().decode().getNumGeometries();
|
||||
} catch (GeometryException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}).toList()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class VerifyMonacoTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testStilInvalidWithOneTile() throws IOException {
|
||||
void testStillInvalidWithOneTile() throws IOException {
|
||||
mbtiles.createTablesWithIndexes();
|
||||
mbtiles.metadataTable().setMetadata("name", "name");
|
||||
try (var writer = mbtiles.newBatchedTileWriter()) {
|
||||
|
||||
Reference in New Issue
Block a user