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

How to create pmtiles? #10

Closed
joernheissler opened this issue Apr 28, 2021 · 9 comments
Closed

How to create pmtiles? #10

joernheissler opened this issue Apr 28, 2021 · 9 comments

Comments

@joernheissler
Copy link

Hello,
how can I create my own pmtiles?

@bdon
Copy link
Member

bdon commented Apr 28, 2021

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

@gibbsnich
Copy link

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
Copy link

reyemtm commented May 7, 2021

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

  • QGIS > Generate XYZ tiles (mbtiles)
  • Use one of the many forks of the gdal2tiles python tool called gdal2mbtiles - just one example
  • Convert a folder tree of an already tiled raster and use the mbutil python tool to package these images into an mbtiles file.

@gibbsnich
Copy link

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
Copy link
Member

bdon commented May 8, 2021

Yes, the converter needs to be fixed to always use TMS for mbtiles input: #8

@bdon
Copy link
Member

bdon commented May 8, 2021

@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
Copy link

Yes, 0.0.5 fixes this issue

@reyemtm
Copy link

reyemtm commented May 8, 2021 via email

@bdon
Copy link
Member

bdon commented May 9, 2021

@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.

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

4 participants