Unexpected GET Requests Count with web-optimized COG #276
-
I'm trying to optimize a COG for our Cesium Terrain on Demand service where we request tiles using rio-tiler with the WGS1984Quad tiling schema. I warp a tiff to 4326 and run the the create command with gdalwarp -t_srs EPSG:4326 R_09BN2.TIF R_09BN2_4326.TIF rio cogeo create R_09BN2_4326.TIF R_09BN2_4326_cog.tif --cog-profile deflate --blocksize 256 --overview-blocksize 256 --tms ./WGS1984Quad.json -w The output works fine in our service but if I profile getting a tile with tilebench (changed to work with WGS1984Quad) it reports 3 GET requests while i would expect 2: head and tile data. tilebench profile http://localhost:3000/R_09BN2_4326_cog.tif --tile 17-134586-26855 --add-kernels | jq {
"HEAD": {
"count": 1
},
"GET": {
"count": 3,
"bytes": 212992,
"ranges": [
"0-65535",
"287064064-287211519"
]
},
"WarpKernels": [],
"Timing": 0.02144479751586914
} Running this for a random tile on zoom 16 even reports Get->Count: 4 tilebench profile http://localhost:3000/R_09BN2_4326_cog.tif --tile 16-67300-13416 --add-kernels | jq {
"HEAD": {
"count": 1
},
"GET": {
"count": 4,
"bytes": 792654,
"ranges": [
"0-65535",
"41233096-41604119",
"45029981-45386074"
]
},
"WarpKernels": [],
"Timing": 0.024923324584960938
}
Driver: GTiff
File: R_09BN2_4326_cog.tif
COG: True
Compression: DEFLATE
ColorSpace: None
Profile
Width: 14336
Height: 10752
Bands: 1
Tiled: True
Dtype: float32
NoData: 3.4028234663852886e+38
Alpha Band: False
Internal Mask: False
Interleave: BAND
ColorMap: False
ColorInterp: ('gray',)
Scales: (1.0,)
Offsets: (0.0,)
Geo
Crs: EPSG:4326
Origin: (4.788665771484176, 53.16146850585942)
Resolution: (5.36441802978515e-06, -5.36441802978515e-06)
BoundingBox: (4.788665771484176, 53.10379028320317, 4.865570068359176, 53.16146850585942)
MinZoom: 12
MaxZoom: 18
Image Metadata
AREA_OR_POINT: Area
OVR_RESAMPLING_ALG: NEAREST
TILING_SCHEME_NAME: WorldCRS84Quad
TILING_SCHEME_ZOOM_LEVEL: 17
Image Structure
COMPRESSION: DEFLATE
INTERLEAVE: BAND
LAYOUT: COG
Band 1
ColorInterp: gray
IFD
Id Size BlockSize Decimation
0 14336x10752 256x256 0
1 7168x5376 256x256 2
2 3584x2688 256x256 4
3 1792x1344 256x256 8
4 896x672 256x256 16
5 448x336 256x256 32
6 224x168 256x256 64
I also tried updating rio-tiler in tilebench and adding Am i doing something wrong? is the GET count as expected? Or is there something else going on? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Hi @tebben thanks for starting this discussion zoom 17
You get 3 GET counts but only 2 Ranges, so I think what's going on is that your COG header is greater than the default can you do
You can also get the size of the COG header using https://github.com/blacha/cogeotiff#command-line-interface Zoom 16When creating the cog, the overviews are not all aligned with the TMS, by default we only align the highest resolution (17)
to fix this you can use the
from GDAL documentation:
To remove the |
Beta Was this translation helpful? Give feedback.
-
Unrelated but, just realized that the TMS id in morecantile for |
Beta Was this translation helpful? Give feedback.
-
Oh wow, thanks for the quick reply and adding the --tms option to tilebench. On my system no GDAL environment variables were set, I just set them using your settings: GDAL_CACHEMAX=75%
GDAL_DISABLE_READDIR_ON_OPEN=EMPTY_DIR
GDAL_HTTP_MERGE_CONSECUTIVE_RANGES=YES
GDAL_HTTP_MULTIPLEX=YES
GDAL_INGESTED_BYTES_AT_OPEN=32768 I reran create with --aligned-levels 4 and cogeo info has the same output as you. Running profile for zoom 16 and 17 has exactly the same output as you. I tested setting Increasing So using --aligned-levels prevents more tile request at lower zooms and the GDAL settings can prevent multiple GET requests for the header. When rio-cogeo creates the overviews automatically, is there a way to also automatically align all levels instead of passing --aligned-levels? |
Beta Was this translation helpful? Give feedback.
Fyi I've just updated
tilebench
to add the--tms
optionzoom 17
Zoom 16
here you can see that GDAL needs an additional GET request for the header