diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index d7e9e525f..f644ffb93 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -20,6 +20,7 @@ - [PostgreSQL Table Sources](sources-pg-tables.md) - [PostgreSQL Function Sources](sources-pg-functions.md) - [MBTiles and PMTiles File Sources](sources-files.md) + - [Cloud Optimized GeoTIFF File Sources](sources-cog-files.md) - [Composite Sources](sources-composite.md) - [Sprite Sources](sources-sprites.md) - [Font Sources](sources-fonts.md) diff --git a/docs/src/sources-cog-files.md b/docs/src/sources-cog-files.md new file mode 100644 index 000000000..2ba581ec6 --- /dev/null +++ b/docs/src/sources-cog-files.md @@ -0,0 +1,44 @@ +# Cloud Optimized GeoTIFF File Sources + +Martin can serve local [COG(Cloud Optimized GeoTIFF)](https://cogeo.org/) files. For cog on remote like S3, you could track it on [issue 875](https://github.com/maplibre/martin/issues/875), we are working on and welcome any assistance. + +> A Cloud Optimized GeoTIFF (COG) is a regular GeoTIFF file, aimed at being hosted on a HTTP file server, with an internal organization that enables more efficient workflows on the cloud. It does this by leveraging the ability of clients issuing ​HTTP GET range requests to ask for just the parts of a file they need. + +|colory type|bits per sample|supported|status| +|----|----|----|----| +|rgb/rgba|8|✅|| +|rgb/rgba|16/32|🛠️|working on| +|gray|8/16/32|🛠️|working on| + + +**Run Martin with CLI to serve cog fiels** +```bash +martin /path/to/dir_contains_cog /path/to/cog.tif +``` + +**Run Martin with configuration file** +```yml +keep_alive: 75 + +# The socket address to bind [default: 0.0.0.0:3000] +listen_addresses: '0.0.0.0:3000' + +# Number of web server workers +worker_processes: 8 + +# Amount of memory (in MB) to use for caching tiles [default: 512, 0 to disable] +cache_size_mb: 8 + +# Database configuration. This can also be a list of PG configs. + +cog: + paths: + # scan this whole dir, matching all *.tif files + - /dir-path + # specific tif file will be published as a cog source + - /path/to/pmt.pmtiles + sources: + # named source matching source name to a single file + cog-src1: /path/to/cog1.tif + cog-src2: /path/to/cog2.tif +``` diff --git a/tests/config.yaml b/tests/config.yaml index 70b08a05c..d963453da 100644 --- a/tests/config.yaml +++ b/tests/config.yaml @@ -180,6 +180,13 @@ sprites: sources: mysrc: tests/fixtures/sprites/src2 +cog: + paths: + - tests/fixtures/cog/rgba_u8_nodata.tif + sources: + cog-src1: tests/fixtures/cog/rgba_u8.tif + cog-src2: tests/fixtures/cog/rgb_u8.tif + fonts: - tests/fixtures/fonts/overpass-mono-regular.ttf - tests/fixtures/fonts diff --git a/tests/expected/configured/catalog_cfg.json b/tests/expected/configured/catalog_cfg.json index 06bdba891..7390808d2 100644 --- a/tests/expected/configured/catalog_cfg.json +++ b/tests/expected/configured/catalog_cfg.json @@ -12,6 +12,12 @@ "content_type": "application/x-protobuf", "description": "autodetect.bigint_table.geom" }, + "cog-src1": { + "content_type": "image/png" + }, + "cog-src2": { + "content_type": "image/png" + }, "fnc_Mixed_Name": { "content_type": "application/x-protobuf", "description": "a function source with MixedCase name" @@ -42,6 +48,9 @@ "content_type": "application/x-protobuf", "description": "public.points3857.geom" }, + "rgba_u8_nodata": { + "content_type": "image/png" + }, "table_source": { "content_type": "application/x-protobuf" }, diff --git a/tests/expected/configured/save_config.yaml b/tests/expected/configured/save_config.yaml index 308490c10..e3d665f0e 100644 --- a/tests/expected/configured/save_config.yaml +++ b/tests/expected/configured/save_config.yaml @@ -166,6 +166,11 @@ pmtiles: pmt: tests/fixtures/pmtiles/stamen_toner__raster_CC-BY+ODbL_z3.pmtiles pmt2: http://localhost:5412/webp2.pmtiles webp2: http://localhost:5412/webp2.pmtiles +cog: + sources: + cog-src1: tests/fixtures/cog/rgba_u8.tif + cog-src2: tests/fixtures/cog/rgb_u8.tif + rgba_u8_nodata: tests/fixtures/cog/rgba_u8_nodata.tif sprites: paths: tests/fixtures/sprites/src1 sources: