protomaps / PMTiles

Cloud-optimized + compressed single-file tile archives for vector and raster maps
https://protomaps.com/docs/pmtiles/
BSD 3-Clause "New" or "Revised" License
2.02k stars 118 forks source link

How to create pmtiles? #10

Closed joernheissler closed 3 years ago

joernheissler commented 3 years ago

Hello, how can I create my own pmtiles?

bdon commented 3 years ago

Right now the only writer implementation I have published is the Python one: https://github.com/protomaps/PMTiles#how-to-use

gibbsnich commented 3 years ago

Can you tell me which tool you used to generate the mbtiles file (which is then input for pmtiles-convert)?
I tried generating mbtiles files with https://github.com/openmaptiles/openmaptiles and https://github.com/systemed/tilemaker but the resulting pmtiles file is off somehow.. Thank you!

reyemtm commented 3 years ago

For raster tiles, you can generate mbtiles using any of the following methods:

gibbsnich commented 3 years ago

Thanks for those recommendations! Will definitly take a closer look. Also.. Did you try to generate an mptiles files from the mbtiles generated with the tools you listed? Did that work? What would you use for vector tiles? If I‘m understanding it correctly openmaptiles uses TMS instead of XYZ; that could be the problem why those mbtiles don‘t work for me..

bdon commented 3 years ago

Yes, the converter needs to be fixed to always use TMS for mbtiles input: https://github.com/protomaps/PMTiles/issues/8

bdon commented 3 years ago

@gibbsnich can you try upgrading to 0.0.5? MBTiles coords should now be properly interpreted as TMS.

@reyemtm on the subject of gdal2pmtiles, it would share most of the logic with gdal2mbtiles, but the last bit of inserting into SQLite is replaced by writing to a stream and managing the directory creation.

In my experience, programs need to use either the GDAL python bindings or C bindings, and the difficulty is making it work for whatever GDAL is on a user's machine, whether it's through Python or a dynamic library. Using the C library will be much faster but still demands having a solution for distributing it to end users.

Maybe another option is to have the pmtiles just use Rasterio as a dependency so we would inherit all the packaging/linking bits (the hard part) from that.

gibbsnich commented 3 years ago

Yes, 0.0.5 fixes this issue

reyemtm commented 3 years ago

I successfully created a pmtiles but am wondering if the algorithm you discuss in your latest blog is present in this version or if that was just a theory, treating a map like a video. From the blog post I imagined the pmtiles would be smaller than the mbtiles file but maybe I am missing something.

On Sat, May 8, 2021, 9:09 AM gibbsnich @.***> wrote:

Yes, 0.0.5 fixes this issue

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/protomaps/PMTiles/issues/10#issuecomment-835356698, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQ2HUM3PJCEP6SHSBWVT3LTMUZYHANCNFSM43W2EVRA .

bdon commented 3 years ago

@reyemtm yes, it will deduplicate tiles based on their hash https://github.com/protomaps/PMTiles/blob/master/python/pmtiles/writer.py#L28

It's possible your MBTiles does not have duplicate data, or your MBTiles already implements deduplication by using a view.