Skip to content
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

Separately addressable countries layer #214

Open
matths opened this issue Jan 10, 2025 · 2 comments
Open

Separately addressable countries layer #214

matths opened this issue Jan 10, 2025 · 2 comments

Comments

@matths
Copy link

matths commented Jan 10, 2025

Hi,

I currently enjoy using Openfreemap hosted Vector Tiles using MapLibreGL.js
This works great for the usual use cases. But now I would like to "reuse" the country shapes without loosing quality by using some simple GeoJSON on top of it.
As far as I know OpenFreemap uses a standard Planetiler workflow to create the Map tiles based on OpenStreeMap data.
This way it provides the whole landmasss outline of the world and as a different layer the boundaries between countries.
I would appreciate some help how OpenFreemap could change the workflow to include a layer with separately addressable countries. (hyperknot/openfreemap#56 (comment))

I know, I could use the MapLibreGL Demotiles instead, but I a have no clue how these were created or who is hosting them and what the rules are to use them.

But I made some progress in how i can change the styling of boundaries (OpenFreemap, https://codepen.io/matths/pen/QwLmjoJ
) or country shapes (MapLibre Demo Tiles, https://codepen.io/matths/pen/azoYNyj) using Javascript.

I know this is not an "issue", but I had no idea how to reach out for some help.

Cheers,
Matthias

@phanecak-maptiler
Copy link
Collaborator

Assuming "standard Planetiler workflow" means "OpenMapTiles" profile, then the code responsible for generating stuff in boundary layer is here:

https://github.com/openmaptiles/planetiler-openmaptiles/blob/main/src/main/java/org/openmaptiles/layers/Boundary.java

While looking there, it is sort of "complicated":

  • Using Natural Earth data for some zoom levels
  • Using OpenStreetMap (OSM) data for other zoom levels
  • And while processing of Natural Earth is quite straightforward, processing of OSM data is not that simple

If you'd like to reuse data from boundary layer, then you need to either find a way how to extract that data from MBTiles or some how re-implement that "boundary java code" for the sole purpose of generating same/similar data into GeoJSON.

Both are options "out of scope" for planetiler-openmaptiles and also outside of my expertise. So, I'll keep this open for a while (in case somebody else is able to chip in), then I'll close this.

@msbarry
Copy link
Collaborator

msbarry commented Jan 13, 2025

You could potentially tweak the boundary logic to create country multi polygons instead of just the borders but the borders are occasionally broken so some might not match exactly. prepareRegionPolygons in the boundary layer already creates country polygons as an intermediate step towards labeling boundary lines, you just need to emit those as polygons instead .

Another alternative to natural earth would be overture division areas which will be a little higher resolution. It has complete polygons already built, with some QA applied before each release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants