maplibre / martin

Blazing fast and lightweight PostGIS, MBtiles and PMtiles tile server, tile generation, and mbtiles tooling.
https://martin.maplibre.org
Apache License 2.0
2.29k stars 216 forks source link

martin-cp doc source param #1236

Closed BigBoulard closed 8 months ago

BigBoulard commented 8 months ago

Hi team,

I think there's something wrong with the martin-cp command description cause there's no my_table in the command line. After reading the other sections of the doc, I understand that source_name can be a comma-separated list of tables from postgres, and probably a comma-separated list of .mbtiles or (strict) .pmtiles files as well.

source: https://maplibre.org/martin/martin-cp.html

I have 4 tables in postgres (created by osm2pgsql):

martin-cp seems to take a single table as a parameter. Does it mean I need to create a new table that combines data from the 4 existing ones and pass it to martin-cp to generate a valid tileset?

This copies tiles from a PostGIS table my_table into an MBTiles file tileset.mbtiles using normalized schema, with zoom levels from 0 to 10, and bounds of the whole world.

martin-cp  --output-file tileset.mbtiles \
           --mbtiles-type normalized     \
           "--bbox=-180,-90,180,90"      \
           --min-zoom 0                  \
           --max-zoom 10                 \
           --source source_name          \
           postgresql://postgres@localhost:5432/db
nyurik commented 8 months ago

martin-cp can take any source as a parameter, which includes a combined comma-separated source as well. Do note that the default osm2pgsql output may not be what you want - take a look at the planetiler tool to generate your tiles directly from OSM dump in a much better schema and much faster.

BigBoulard commented 8 months ago

Do note that the default osm2pgsql output may not be what you want - take a look at the planetiler tool to generate your tiles directly from OSM dump in a much better schema and much faster.

Trying to create a public repo to illustrate something I struggle to do, I wondered why martin-cp needs postgres to generate a mbtiles file and if it's something mandatory. Because I understand martin can serve mbtiles files to render a map in a browser or another GIS client without postgres https://maplibre.org/martin/sources-files.html, hence this question. There is some context I'm missing about all these tools and their use cases, sorry if my question sounds stupid. I understand that martin-cp is still under development and cannot be considered 100% ready for mbtiles file generation, correct? But, still for serving tiles with Martin, I used to feed postgres with a map file from using osm2pgsql and let Martin serve the tiles from postgres, is it still the advised procedure? Thank you so much.

nyurik commented 8 months ago

All depends on your usecase, as always. If you are building "base map" - use something like planetiler to pre-generate it into an mbtiles/pmtiles file. Generating tiles on the fly for the base map could be expensive (slow). Think of it as a tile cache. Martin can serve that file - no postgres needed.

If you are generating custom data on top of a base map, e.g. taxi info like in the demo, martin could get that data from a database, possibly even with custom parameters (like in the demo). If you are serving tiles and need some extras - like fonts or sprites - martin can handle that for you too.