-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clip tileset to a polygonal boundary #351
Conversation
tiles/src/main/java/com/protomaps/basemap/postprocess/Clip.java
Outdated
Show resolved
Hide resolved
|
||
public Clip(Stats stats, Geometry input) { | ||
this.stats = stats; | ||
var clipGeometry = latLonToWorldCoords(input).buffer(0.00001); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be configurable buffer size via arguments?
tiles/src/main/java/com/protomaps/basemap/postprocess/Clip.java
Outdated
Show resolved
Hide resolved
tiles/src/main/java/com/protomaps/basemap/postprocess/Clip.java
Outdated
Show resolved
Hide resolved
tiles/src/main/java/com/protomaps/basemap/postprocess/Clip.java
Outdated
Show resolved
Hide resolved
Do you store the clipping mask in world coordinates (web mercator x y of the 0/0/0 tile) or do you store it in tile coordinates? |
I saw you have a covering tiles mechanism. I think you could get rid of this by using an STRtree https://locationtech.github.io/jts/javadoc/org/locationtech/jts/index/strtree/STRtree.html and use the tile bounds as an envelope for querying |
* pass a GeoJSON feature polygon or multipolygon to clip the entire tileset. * output for country or city sized basemaps looks better when zoomed out. * implement an internal tiled index so there is minimal performance impact.
|
Implements #51
This is to address making non-global maps: for example, a map of a single continent, country, or city. The existing tooling has a path to doing this with
pmtiles extract
on a planet file, but this has a downside: the output tileset is not clipped to the AOI (area of interest) and shows the entire detail of the original source tileset at lower zoom levels.Additionally, if the input OSM data has features that lie outside of the AOI, like oceans or roads, those extend beyond the boundary. This is not a fatal problem for many use cases, but we can do better in our tile generation program by clipping every feature to the AOI.
The challenges here are: