Skip to content

hstin-de/pmtiles-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pmtiles-cpp

Tiny C++17 lib with a plain C API to write PMTiles v3. Internal dirs+metadata are gzip-compressed; tile payloads are written as-is. Output bytes match the reference.

Disclaimer: Independent project — not affiliated with, endorsed by, or sponsored by PMTiles or Protomaps.

Build

Deps: zlib, xxhash Arch: sudo pacman -S base-devel cmake zlib xxhash

cmake -S . -B build -DPMTILES_BUILD_SHARED=ON
cmake --build build --config Release
# optional
sudo cmake --install build

API (see include/pmtiles.h)

struct pm_tile_in { int z, x, y; const uint8_t* data; int len; };
int  pmtiles_build_to_file (const struct pm_tile_in*, int, uint8_t, uint8_t, const char*);
/* malloc'd buffer; free with pmtiles_free_buffer */
int  pmtiles_build_to_memory(const struct pm_tile_in*, int, uint8_t, uint8_t, uint8_t** , int*);
void pmtiles_free_buffer(void*);

Minimal example

struct pm_tile_in t[] = { {0,0,0, webp_bytes, webp_len} };
if (!pmtiles_build_to_file(t, 1, 0, 0, "out.pmtiles")) return 1;

About

Tiny C++17 lib with a plain C API to write PMTiles v3

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published