diff --git a/linespace_shade/pom-xml-flattened b/linespace_shade/pom-xml-flattened new file mode 100644 index 0000000000..06ca81407c --- /dev/null +++ b/linespace_shade/pom-xml-flattened @@ -0,0 +1,131 @@ + + + 4.0.0 + + com.onthegomap.planetiler + planetiler-parent + 0.8.3 + + com.onthegomap.planetiler + linespace_shade + 0.8.3 + + + Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + com.onthegomap.planetiler + planetiler-core + ${project.parent.version} + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + + + + + blue.strategic.parquet + parquet-floor + 1.44 + + + com.google.protobuf + protobuf-java + 3.25.3 + + + com.fasterxml.jackson.core + jackson-databind + 2.17.1 + + + com.fasterxml.jackson.core + jackson-core + 2.17.1 + + + com.fasterxml.jackson.core + jackson-annotations + 2.17.1 + + + + + + maven-shade-plugin + 3.6.0 + + + package + + shade + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + org.apache.hadoop + shade.org.apache.hadoop + + + com.google.protobuf + shade.com.google.protobuf + + + google.protobuf + shade.google.protobuf + + + com.fasterxml.jackson.annotation + shade.com.fasterxml.jackson.annotation + + + com.fasterxml.jackson.core + shade.com.fasterxml.jackson.core + + + com.fasterxml.jackson.databind + shade.com.fasterxml.jackson.databind + + + com.fasterxml.jackson.dataformat.csv + shade.com.fasterxml.jackson.dataformat.csv + + + com.fasterxml.jackson.dataformat.xml + shade.com.fasterxml.jackson.dataformat.xml + + + com.fasterxml.jackson.datatype.jdk8 + shade.com.fasterxml.jackson.datatype.jdk8 + + + com.fasterxml.jackson.datatype.jsr310 + com.fasterxml.jackson.datatype.jsr310 + + + + + + + false + + + + + diff --git a/planetiler-benchmarks/pom-xml-flattened b/planetiler-benchmarks/pom-xml-flattened new file mode 100644 index 0000000000..930e2f33ed --- /dev/null +++ b/planetiler-benchmarks/pom-xml-flattened @@ -0,0 +1,63 @@ + + + 4.0.0 + + com.onthegomap.planetiler + planetiler-parent + 0.8.3 + + com.onthegomap.planetiler + planetiler-benchmarks + 0.8.3 + + + Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + com.onthegomap.planetiler + planetiler-core + 0.8 + + + org.openmaptiles + planetiler-openmaptiles + 0.8 + + + + + + maven-assembly-plugin + 3.7.1 + + + com.onthegomap.planetiler + planetiler-core + ${project.parent.version} + + + + + + true + + + + with-deps + + + + + maven-deploy-plugin + + true + + + + + diff --git a/planetiler-core/pom-xml-flattened b/planetiler-core/pom-xml-flattened new file mode 100644 index 0000000000..483f104751 --- /dev/null +++ b/planetiler-core/pom-xml-flattened @@ -0,0 +1,269 @@ + + + 4.0.0 + + com.onthegomap.planetiler + planetiler-parent + 0.8.3 + + com.onthegomap.planetiler + planetiler-core + 0.8.3 + Planetiler Core + Planetiler is tool to build planet-scale vector tilesets from OpenStreetMap data fast. + + + Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + 0.16.0 + 3.25.4 + 6.6.5 + 2.23.1 + 31.3 + + + + com.carrotsearch + hppc + 0.10.0 + + + org.roaringbitmap + RoaringBitmap + 1.2.1 + + + com.google.protobuf + protobuf-java + ${protobuf.version} + + + com.github.jnr + jnr-ffi + 2.2.16 + + + org.locationtech.jts + jts-core + ${jts.version} + + + org.tukaani + xz + 1.10 + + + org.geotools + gt-shapefile + ${geotools.version} + + + org.geotools + gt-epsg-hsql + ${geotools.version} + + + org.xerial + sqlite-jdbc + 3.46.0.1 + + + org.msgpack + msgpack-core + 0.9.8 + + + org.slf4j + slf4j-api + 2.0.16 + + + org.apache.logging.log4j + log4j-slf4j2-impl + ${log4j.version} + + + org.apache.logging.log4j + log4j-api + ${log4j.version} + + + org.apache.logging.log4j + log4j-core + ${log4j.version} + + + com.fasterxml.jackson.core + jackson-core + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jdk8 + ${jackson.version} + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + ${jackson.version} + + + com.fasterxml.jackson.dataformat + jackson-dataformat-csv + ${jackson.version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson.version} + + + org.snakeyaml + snakeyaml-engine + + + io.prometheus + simpleclient + ${prometheus.version} + + + io.prometheus + simpleclient_common + ${prometheus.version} + + + io.prometheus + simpleclient_pushgateway + ${prometheus.version} + + + io.prometheus + simpleclient_hotspot + ${prometheus.version} + + + com.ibm.icu + icu4j + 75.1 + + + com.google.guava + guava + 33.2.1-jre + + + mil.nga.geopackage + geopackage + ${geopackage.version} + + + org.slf4j + slf4j-nop + + + + + org.xerial.snappy + snappy-java + 1.1.10.6 + + + blue.strategic.parquet + parquet-floor + 1.45 + + + io.minio + minio + 8.5.10 + + + + + + kr.motd.maven + os-maven-plugin + 1.7.1 + + + + + true + src/main/resources + + buildinfo.properties + + + + false + src/main/resources + + buildinfo.properties + + + + + + false + src/test/resources + + + + + + maven-jar-plugin + 3.4.2 + + + + test-jar + + + + + + *.wkb + *.mbtiles + *.sqlite + + + + + + + + maven-javadoc-plugin + + + io.github.zlika + reproducible-build-maven-plugin + + + org.xolstice.maven.plugins + protobuf-maven-plugin + 0.6.1 + + + + compile + test-compile + + + + + com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier} + + + + + diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/ScalableLandCoverTileProcessor.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/ScalableLandCoverTileProcessor.java new file mode 100644 index 0000000000..6ec33edaec --- /dev/null +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/ScalableLandCoverTileProcessor.java @@ -0,0 +1,129 @@ +package com.onthegomap.planetiler; + +import com.onthegomap.planetiler.geo.GeometryException; +import com.onthegomap.planetiler.geo.TileCoord; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.locationtech.jts.geom.Geometry; +import org.locationtech.jts.geom.GeometryFactory; + +public class ScalableLandCoverTileProcessor implements ForwardingProfile.LayerPostProcesser, + ForwardingProfile.TilePostProcessor { + + private static final int MAX_ZOOM = 14; + private static final int RASTERIZE_ZOOM_THRESHOLD = 11; + private static final GeometryFactory geometryFactory = new GeometryFactory(); + private static final int TILE_SIZE = 4096; + + @Override + public String name() { + return "land_cover"; + } + + @Override + public List postProcess(int zoom, List items) throws GeometryException { + if (zoom > MAX_ZOOM) { + return items; + } + + List processedFeatures = new ArrayList<>(); + + for (VectorTile.Feature feature : items) { + VectorTile.Feature processedFeature = processFeature(feature, zoom); + if (processedFeature != null) { + processedFeatures.add(processedFeature); + } + } + + return processedFeatures; + } + + @Override + public Map> postProcessTile(TileCoord tileCoord, + Map> layers) throws GeometryException { + if (!layers.containsKey(name())) { + return layers; + } + + List features = layers.get(name()); + List processedFeatures = postProcess(tileCoord.z(), features); + + Map> result = new HashMap<>(layers); + result.put(name(), processedFeatures); + return result; + } + + private VectorTile.Feature processFeature(VectorTile.Feature feature, int zoom) throws GeometryException { + Geometry geometry = feature.geometry().decode(); + + if (zoom == MAX_ZOOM) { + return feature; + } else if (zoom <= RASTERIZE_ZOOM_THRESHOLD) { + geometry = rasterizeGeometry(geometry, zoom, feature.id()); + } else { + geometry = simplifyGeometry(geometry, zoom); + } + + if (geometry.isEmpty()) { + return null; + } + + return feature.copyWithNewGeometry(geometry); + } + + private Geometry rasterizeGeometry(Geometry geometry, int zoom, long featureId) { + boolean[][] grid = new boolean[TILE_SIZE][TILE_SIZE]; + + // 填充网格 + for (int x = 0; x < TILE_SIZE; x++) { + for (int y = 0; y < TILE_SIZE; y++) { + Geometry pixel = createPixel(x, y, TILE_SIZE); + if (geometry.intersects(pixel)) { + grid[x][y] = true; + } + } + } + + // 将网格转换回几何形状 + return convertGridToGeometry(grid); + } + + private Geometry createPixel(int x, int y, int gridSize) { + double size = 1.0 / gridSize; + return geometryFactory.toGeometry(new org.locationtech.jts.geom.Envelope( + x * size, (x + 1) * size, y * size, (y + 1) * size + )); + } + + private Geometry convertGridToGeometry(boolean[][] grid) { + List pixels = new ArrayList<>(); + for (int x = 0; x < grid.length; x++) { + for (int y = 0; y < grid[x].length; y++) { + if (grid[x][y]) { + pixels.add(createPixel(x, y, grid.length)); + } + } + } + return geometryFactory.buildGeometry(pixels).union(); + } + + private Geometry simplifyGeometry(Geometry geometry, int zoom) { + double tolerance = calculateSimplificationTolerance(zoom); + return org.locationtech.jts.simplify.TopologyPreservingSimplifier.simplify(geometry, tolerance); + } + + private double calculateSimplificationTolerance(int zoom) { + return 1.0 / (1 << zoom); + } + + // 新增:处理多个要素重叠的情况 + private VectorTile.Feature resolveOverlappingFeatures(List overlappingFeatures) { + // 这里实现一个策略来决定哪个要素应该"获胜" + // 例如,可以选择面积最大的要素,或者根据某些属性进行优先级排序 + // 为了示例,这里简单地选择第一个要素 + VectorTile.Feature feature = overlappingFeatures.get(0); + return feature; + } +} diff --git a/planetiler-custommap/pom-xml-flattened b/planetiler-custommap/pom-xml-flattened new file mode 100644 index 0000000000..63a14be5ae --- /dev/null +++ b/planetiler-custommap/pom-xml-flattened @@ -0,0 +1,68 @@ + + + 4.0.0 + + com.onthegomap.planetiler + planetiler-parent + 0.8.3 + + com.onthegomap.planetiler + planetiler-custommap + 0.8.3 + + + Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + org.projectnessie.cel + cel-bom + 0.4.5 + pom + import + + + + + + com.onthegomap.planetiler + planetiler-core + ${project.parent.version} + + + org.commonmark + commonmark + + + org.projectnessie.cel + cel-tools + 0.4.5 + + + com.onthegomap.planetiler + planetiler-core + ${project.parent.version} + test-jar + test + + + + + + io.github.zlika + reproducible-build-maven-plugin + + + maven-deploy-plugin + + true + + + + + diff --git a/planetiler-dist/pom-xml-flattened b/planetiler-dist/pom-xml-flattened new file mode 100644 index 0000000000..3ca3069aa6 --- /dev/null +++ b/planetiler-dist/pom-xml-flattened @@ -0,0 +1,168 @@ + + + 4.0.0 + + com.onthegomap.planetiler + planetiler-parent + 0.8.3 + + com.onthegomap.planetiler + planetiler-dist + 0.8.3 + + + Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + ghcr.io/onthegomap/planetiler:${image.version} + 17 + com.onthegomap.planetiler.Main + ${project.version} + 17 + linux + package + amd64 + + + + com.onthegomap.planetiler + planetiler-benchmarks + ${project.parent.version} + + + org.openmaptiles + planetiler-openmaptiles + ${project.parent.version} + + + com.onthegomap.planetiler + planetiler-custommap + ${project.parent.version} + + + com.onthegomap.planetiler + planetiler-examples + ${project.parent.version} + + + com.onthegomap.planetiler + planetiler-core + ${project.parent.version} + sources + + + org.locationtech.jts + jts-core + ${jts.version} + sources + + + + + + com.google.cloud.tools + jib-maven-plugin + + false + + eclipse-temurin:21-jre + + + ${jib.platform-arch} + ${jib.platform-os} + + + + + ${image} + + + + https://github.com/onthegomap/planetiler + + ${mainClass} + ${maven.build.timestamp} + ${maven.build.timestamp} + + + + + maven-assembly-plugin + 3.7.1 + + + make-assembly + ${assembly-phase} + + single + + + + + + com.onthegomap.planetiler + planetiler-core + ${project.version} + + + + + + true + + + ${mainClass} + + + + with-deps + + false + + + + maven-deploy-plugin + + true + + + + + + + skip-assembly + + none + + + + jib-multi-arch + + + + com.google.cloud.tools + jib-maven-plugin + + + + + amd64 + linux + + + arm64 + linux + + + + + + + + + + diff --git a/planetiler-examples/pom-xml-flattened b/planetiler-examples/pom-xml-flattened new file mode 100644 index 0000000000..2efdccd4af --- /dev/null +++ b/planetiler-examples/pom-xml-flattened @@ -0,0 +1,48 @@ + + + 4.0.0 + + com.onthegomap.planetiler + planetiler-parent + 0.8.3 + + com.onthegomap.planetiler + planetiler-examples + 0.8.3 + + + Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + com.onthegomap.planetiler + planetiler-core + ${project.parent.version} + + + com.onthegomap.planetiler + planetiler-core + ${project.parent.version} + test-jar + test + + + + + + io.github.zlika + reproducible-build-maven-plugin + + + maven-deploy-plugin + + true + + + + + diff --git a/pom-xml-flattened b/pom-xml-flattened new file mode 100644 index 0000000000..ea5c5679c7 --- /dev/null +++ b/pom-xml-flattened @@ -0,0 +1,61 @@ + + + + 4.0.0 + + com.onthegomap.planetiler + planetiler-parent + 0.8.3 + ./ + + org.openmaptiles + planetiler-openmaptiles + 0.8.3 + + + Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + com.onthegomap.planetiler + planetiler-core + ${project.version} + + + org.yaml + snakeyaml + 2.2 + + + org.commonmark + commonmark + + + com.onthegomap.planetiler + planetiler-core + ${project.version} + test-jar + test + + + + planetiler-openmaptiles/src/main/java + planetiler-openmaptiles/src/test/java + + + io.github.zlika + reproducible-build-maven-plugin + + + maven-deploy-plugin + + true + + + + +