onthegomap / planetiler

Flexible tool to build planet-scale vector tilesets from OpenStreetMap data fast
Apache License 2.0
1.28k stars 104 forks source link

[FEATURE] Customization of OpenMapTiles #105

Closed wipfli closed 2 years ago

wipfli commented 2 years ago

Is your feature request related to a problem? Please describe. Problem 1: License. The license of OpenMapTiles is confusing me. I am never sure if I can use OpenMapTiles for a commercial project. I don't know if I have to give attribution to OpenMapTiles if I use for example only a single layer from OpenMapTiles like --only_layers=transportation.

Problem 2: Customization. OpenMapTiles is a great start to make a map. But I don't need all the information it provides (e.g. landcover farmland). And other information is missing (e.g. powerlines). I don't know what is the best way to do this. Fork and edit the base profile?

Describe the solution you'd like I would like to make a map from ground up where I say I would like to have roads, houses, residential area, forest, water, place names. The building blocks could still use the logic that is already implemented in the base profile.

Describe alternatives you've considered My current approach would be to comment out all the things I do not need in the base profile and add new layers with my custom information.

Additional context Discussion #81 is probably related to this issue.

Since the resulting tiles are not compliant with the OpenMapTiles schema, I would like to remove the attribution altogether. I don't know if this is unfair? It just feels wrong to keep linking to OpenMapTiles if the technology used for the map tiles is a different one...

msbarry commented 2 years ago

I think the only caveat of using a schema based on OpenMapTiles is that you need to carry along the visible "© OpenMapTiles" copyright that links to https://openmaptiles.org/. Any schema that uses any part of openmaptiles (or the basemap profile) needs to carry that along.

For customizing openmaptiles, my thought was:

A lot of people are coming from OpenMapTiles, so I think it makes sense to maintain a profile that's compatible with it, but I agree that it would be nice to have a clean-sheet schema built from the ground up with no attribution requirements (similar to osm carto). To collaborate on that I think we want a stable API for configurable schema definitions so that more people can collaborate on that than are interested in writing Java code. Baremaps is also working on something similar, a common config format between the two projects would let us use that with planetiler as well.

boldtrn commented 2 years ago

OpenMapTiles is great compatibility wise, there is already a large community and a lot of tools, styles, etc. that support it. So having it as one possible schema would be good.

IMHO: OSM is already providing tags. While they might make writing map styles more complicated, I think it would good to use these tags for a schema. In the long run, this could also enable a similar style to carto-osm and even a style that is equal to carto-osm based on vector tiles. So I think this is something worth considering.

OMT simplifies many tags which makes writing styles easier, but loses many details during that transformation.

klokan commented 2 years ago

Let me react to the mentioned problems:

Problem 1: License. The license of OpenMapTiles is confusing me. I am never sure if I can use OpenMapTiles for a commercial project. I don't know if I have to give attribution to OpenMapTiles if I use for example only a single layer from OpenMapTiles like --only_layers=transportation.

Yes, you can use OpenMapTiles for your commercial project! The licence is BSD-3 + CC-BY. You can modify, reimplement, use it whole or a part, including commercially - with the condition that you display attribution - exactly as @msbarry mentioned. There are a lot of commercial players using OpenMapTiles, tools, styles, alternative implementations, etc.

Problem 2: Customization. OpenMapTiles is a great start to make a map. But I don't need all the information it provides (e.g. landcover farmland). And other information is missing (e.g. powerlines). I don't know what is the best way to do this. Fork and edit the base profile?

The best practice currently is to modify the config of the schema.

Remove layers you don't want by commenting them out in top YAML - same for unwanted properties in the layer YAML. Modify the zooms or generalization in the code. Add your own tags from OSM database which are missing (and if you see value for community, make a pull request 😉 ).

People starting with OpenMapTIles can check the video recording from State Of the Map conference - showing how custom layers are configured: https://youtu.be/bdOjVghEx3E?t=962 and how data are generated. This is how you can easily add any missing information into the tiles or generate just the data you want/

Planetiler partly uses the OpenMapTiles YAML files already - and discussion started how to adopt the config driven schema - the way that it is easy to understand for people how to modify.

There were discussion on preparing "presets" for the layers.

BTW There are approaches how to shrink the tiles after they are generated to have optimal size for your style. Performance tests show that if you don't render the features in tiles, the map displays almost equally fast - as unused features in MVT are skipped efficiently. Optimization are typically download time, size of the storage, amount of network traffic.

Very happy to discuss further...

wipfli commented 2 years ago

I played a little bit around with making my own transportation layer and quickly found out that this is really a challenging task. I was able to extract lines from OSM, but then you still have to do motorway line merges, handle tunnels and bridges, and decide on what zoom level to show which feature. So I am really thankful that OpenMapTiles does all this work for me and am happy to show the attribution on the map. I will update the title of this issue...

Thanks for the license clarification @klokan.

Regarding customization, for me a nice way seems to fork planetiler, edit the basemap (add tags and layers as needed), and rebuild planetiler. Like that I can profit from OpenMapTiles updates. For easier git merges after customization of the base map, I think flattening out Tables.java as proposed in #109 is useful.

wipfli commented 2 years ago

Add a custom tag to OpenMapTiles: https://gist.github.com/wipfli/02ba9081b26c3a0cfae054e5c5402fe7

Add a custom layer to OpenMapTiles: https://gist.github.com/wipfli/036aceb4a8008a10253b34ac1ded728f