-
-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cloud Optimized GeoTIFF (COG) support #875
Comments
I like the idea, thanks! One aspect that I am not too certain about is combining things into 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. |
I've built a simple C# prototype without |
Tif with Non-Square pixelSquare Non-Square If it's non-square, we should adjust the output PNG size based on the resolution of X or Y and we should tell the user the resolution we picked in our TileJSON. PseudoCode let (resolution_x, resolution_y) = get_tiff_resolutions();
let ratio = resolution_x / Math.abs(resolution_y); // we always pick resolution_x as the resolution
let output_tile_size = (tif_tile_size[0], tif_tile_size[1] / ratio); I'm not sure how often we encounter TIF files with non-square pixels. We will handle this when needed. |
The tile-schema and tile-jsonClients needs to know the tile-schema(like We must add these in tile json and it's the most high priority. And Another to be noted is: Should we handle the google-schema specially?The tile-schema could be If it's google compatible, Should we do a transformation internally, like if we have 5 layers in a GoogleMapsCompatible tiff file: Add a google compatible in tile-json when it's tiff file. {
...,
"min_zoom": 10,
"max_zoom": 14,
"googleMapsCompatibled": "true",
...
}
|
Try to fix #875 . Still a draft and a lot to discuss and finish. - [ ] Remote file on like S3. We will make it in next PRs. Let's make this PR just a basic start. - [x] Made the padded part transparent - [x] Made the [gdal nodata](https://gdal.org/en/stable/drivers/raster/gtiff.html#nodata-value) transparent - [x] Add tests - [x] Add doc - [x] Support rgb/rgba u8 tif tiled image. We will do others in next PRs and leave this PR simple. ## Color types and bits per smaple |colory type|bits per sample|supported|status| |----|----|----|----| |rgb/rgba|8|✅|| |rgb/rgba|16/32...|🛠️|working on, will be added in next PRs| |gray|8/16/32...|🛠️|working on, will be added in next PRs| ## Comporession The crate we used support these methods. | Compression Format | tiff crate(This PR based on this) | GDAL creation optinos | |--------------------|------------------|----------------| | None | ✓ | ✓ | | LZW | ✓ | ✓ (gdal default) | | JPEG | | ✓ | | Deflate | ✓ | ✓ | | ZSTD | | ✓ | | WEBP | | ✓ | | LERC | | ✓ | | LERC_DEFLATE | | ✓ | | LERC_ZSTD | | ✓ | | LZMA | | ✓ | | PackBits | ✓ | Not sure but couldn't find this on gdal doc | ## Some terms and ref links [7.1.2 Tiles in COG spec](https://docs.ogc.org/is/21-026/21-026.html#_tiles) [Tiff 6.0 spec page 67](https%3A%2F%2Fwww.itu.int%2Fitudoc%2Fitu-t%2Fcom16%2Ftiff-fx%2Fdocs%2Ftiff6.pdf) [Chapter 4 of COG spec](https://docs.ogc.org/is/21-026/21-026.html#_terms_and_definitions) ## Tile and padding > In the context for a TIFF file, Tiling is a strategy for dividing the content in the TIFF file differently than using the classical Strips. Tiles, as defined in the TIFF version 6.0 specification, can be mapped to the ones defined in the OGC Two Dimensional Tile Matrix Set Standard (2D-TMS). For example in 2D-TMS, the TIFF 6.0 forces all tiles to be of the same size. This is possible with the introduction of the concept of padding: if necessary extra blank rows or columns are added to the right-most and bottom-most tile to make them the same shape as other tiles. However, the naming of the TIFF tags used version 6.0 and the property names used in the 2D-TMS differ. The following table provides a mapping between the two standards. | OGC 2D-TMS | TIFF v. 6.0 | Definition | |---------------|--------------|-------------------------------------------------| | TileWidth | TileWidth | The tile width in pixels. The number of columns in each tile | | TileHeight | TileLength | The tile height in pixels. The number of rows in each tile | | MatrixWidth | TilesAcross | Number of tiles in the width direction | | MatrixHeight | TilesDown | Number of tiles in the height direction --------- Co-authored-by: Yuri Astrakhan <[email protected]>
I find a better subfiles organization description: https://docs.ogc.org/per/21-025.html#toc33 @nyurik @CommanderStorm |
And a tool to help view the internal details of a tiff file, sudo apt update
sudo apt install libimage-exiftool-perl
exiftool ./rgba_u8_nodata.tiff -a -U -g1 |
none of these actually define COG data format the spec seem incomplete |
I think i have created valid cog with alpha channel and 8 bit:
I dont think martin support serving COG:
Is it possible to get a sample cog that martin supports: |
@sheecegardezi you are not running a See this issue for further context: |
@CommanderStorm thanks for picking that up! I just tested it works like a charm with nightly build. For completeness following worked:
|
I will add tile schema of COG to tile json. It's not convenient for clients to load COG without it. Traveling, I will be back next day. |
Add support for Cloud Optimized GeoTIFF (COG).
CLI
Conf file
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?
Things to track:
done by Add basic cog support #1590
*.tif
and*.tiff
done by Autodiscover
*.tiff
files in addition to*.tif
#1635The text was updated successfully, but these errors were encountered: