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
1.83k stars 100 forks source link

CLI tool to convert raster to pmtiles #338

Open daniel-j-h opened 6 months ago

daniel-j-h commented 6 months ago

The protomaps format allows for raster tile hierarchies.

We've been working with bundling up raster tiles recently and ended up using the python library from https://github.com/protomaps/PMTiles to do so (see also example in https://github.com/protomaps/PMTiles/blob/e1228f5df1a4ac852e0117dc08c8813089a5c8af/python/examples/create_raster_example.py).

What would have made that workflow simpler is a cli tool like pmtiles convert but instead of converting mbtiles into pmtiles it would take e.g. a slippy map tile hierarchy as in z/x/y.ext or a GeoTIF raster and turn it into a pmtiles file.

Should the convert sub-command be extended to support raster, too?

bdon commented 6 months ago

It's a good feature request - anything that interacts with GeoTIFF or raster formats will probably depend on GDAL, which is out of scope for go-pmtiles. I've heard the best outputs come from rasterio and rio-mbtiles here: https://docs.protomaps.com/pmtiles/create#geotiff after which you can use go-pmtiles convert

so maybe we just need to make a rio-pmtiles equivalent?

bmcbride commented 5 months ago

A rio-pmtiles equivalent to directly convert GeoTIFF to PMTiles would be awesome, especially if the functionality was able to be added to go-pmtiles, giving the user the option to convert either MBTiles or GeoTIFF.

bdon commented 5 months ago

It's unlikely this would be part of go-pmtiles because it would need to depend on GDAL. A python package installed through pip run via a rasterio command e.g. rio pmtiles ... I think would be the easiest path.

bdon commented 5 months ago

issue transferred to main PMTiles repository

mabhub commented 4 months ago

What would have made that workflow simpler is a cli tool like pmtiles convert but instead of converting mbtiles into pmtiles it would take e.g. a slippy map tile hierarchy as in z/x/y.ext or a GeoTIF raster and turn it into a pmtiles file.

Isn't it already kinda simple by the use of mb-util which allow to convert tiles file tree to mbtiles, then converting it to pmtiles with pmtiles convert?

$ mb-util my-tiles-root-directory my_tiles.mbtiles
$ pmtiles convert my_tiles.mbtiles my_tiles.pmtiles
neodescis commented 2 weeks ago

What would have made that workflow simpler is a cli tool like pmtiles convert but instead of converting mbtiles into pmtiles it would take e.g. a slippy map tile hierarchy as in z/x/y.ext or a GeoTIF raster and turn it into a pmtiles file.

Isn't it already kinda simple by the use of mb-util which allow to convert tiles file tree to mbtiles, then converting it to pmtiles with pmtiles convert?

$ mb-util my-tiles-root-directory my_tiles.mbtiles
$ pmtiles convert my_tiles.mbtiles my_tiles.pmtiles

This is the route I went to convert some terrain tiles. It is indeed pretty simple, but:

  1. This is not an obvious path to take for someone who doesn't know anything about mbtiles
  2. It seems bad for pmtiles to depend on mb-util like this to get archives created