maplibre / martin

Blazing fast and lightweight PostGIS, MBtiles and PMtiles tile server, tile generation, and mbtiles tooling.
https://martin.maplibre.org
Apache License 2.0
2.27k stars 212 forks source link

COG support #875

Open sharkAndshark opened 1 year ago

sharkAndshark commented 1 year ago

Add support for Cloud Optimized GeoTIFF (COG).

CLI

martin  /path/to/cogs/file.tif  /path/to/directory

Conf file

...
cogs:
  paths:
    # scan this whole dir, matching all *.tif files
    - /dir-path
    # specific cog file will be published as cog source
    - /path/to/file1.tif
  sources:
   # named source matching source name to a single file
    cog-src1:  /path/to/file.tif

It seems that the conf sections about PMTiles and MBTiles are very similar. I don't know maybe we could merge them into a single section?

files:
  paths:
    - /dir1
    - /path/to/file1.ext
  sources:
    source1: /path/to/file.ext
nyurik commented 1 year ago

I like the idea, thanks! One aspect that I am not too certain about is combining things into files -- one of highly requested features for files it to serve them from http -- in order words, pmtiles and i suspect COG files will reside in some cloud bucket, and Martin will access them with the HTTP range requests.

This means that we would need to tell the type of that file without relying on file extension. We could try to auto-detect it - e.g. get first few bytes and detect the type, but it won't be relevant to mbtiles, so in short - much easier to keep things clean and separate.

sharkAndshark commented 1 year ago

Some refs:

sharkAndshark commented 4 days ago

I've built a simple C# prototype without gdal, and am working on to port it to Rust. The config would be separated as @nyurik suggested.