Improved Documentation
Hi,
Please could you add examples of how to use pmtiles via docker to build or upload pmtiles
Beleive it something like docker run -v $(pwd)/data:/var/ ghcr.io/protomaps/go-pmtiles:main convert radon.pmtiles radon.mbtiles, however this doesn't work for me.
Please could you also provide more detailed instructions to install on linux - I can see the binary but don't know how to install
I'll happily add to the readme and submit a PR once I know how.
Kind regards,
Edd
The linux binary does not need installation, you simply run the binary with ./pmtiles. This should also obviate the need for Docker.
I'm also running the pmtiles binary through docker and can give some input here in case that helps:
docker run -v $(pwd)/data:/var/ ghcr.io/protomaps/go-pmtiles:main convert radon.pmtiles radon.mbtiles
In your command here you mount your ./data directory into the container at /var/ and because convert runs inside the container you have to prefix your input and output paths with /var/, too.
Below is an example of how I run it. I noticed I also had to change the TMPDIR env var because otherwise the creation of temporary files does not seem to work with the scratch image by default, resulting in
2024/05/09 10:39:36 main.go:177: Failed to create temp file, open /tmp/pmtiles2186268370: no such file or directory
This runs the latest go-pmtiles to convert a .mbtiles file to a .pmtiles file; pretty neat!
$ docker run -it --rm --pull always -e TMPDIR=/data -v $(pwd):/data ghcr.io/protomaps/go-pmtiles:main convert /data/monaco-latest.mbtiles /data/monaco-latest.pmtiles
main: Pulling from protomaps/go-pmtiles
Digest: sha256:9627edcd10eed2936c63602333f13270644d659d823d2478fa60c1dac99d60b1
Status: Image is up to date for ghcr.io/protomaps/go-pmtiles:main
2024/05/09 10:39:46 convert.go:260: Pass 1: Assembling TileID set
2024/05/09 10:39:46 convert.go:291: Pass 2: writing tiles
100% |███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| (22/22, 10100 it/s)
2024/05/09 10:39:46 convert.go:345: # of addressed tiles: 22
2024/05/09 10:39:46 convert.go:346: # of tile entries (after RLE): 22
2024/05/09 10:39:46 convert.go:347: # of tile contents: 22
2024/05/09 10:39:46 convert.go:369: Total dir bytes: 123
2024/05/09 10:39:46 convert.go:370: Average bytes per addressed tile: 5.59
2024/05/09 10:39:46 convert.go:340: Finished in 12.034584ms
New docs for CLI here: https://docs.protomaps.com/pmtiles/cli
added Docker example here: https://docs.protomaps.com/pmtiles/cli#convert
TMPDIR in Docker was resolved by https://github.com/protomaps/go-pmtiles/pull/171