Closed Plantain closed 8 months ago
@Plantain I wouldn't compare GDAL COG with rio-tiler but you can compare the output of gdalwarp command to read part of your file
import os
from rio_tiler.io import Reader
with Reader("http://static.skysight.io/rio-bug/orig.tiff") as src:
img = src.tile(226, 162 ,8, tilesize=512, reproject_method="nearest", resampling_method="nearest")
with open("226-162-8_RIOTILER.png", "wb") as f:
f.write(img.render())
os.system("gdalwarp -of PNG -q /vsicurl/http://static.skysight.io/rio-bug/orig.tiff 226-162-8_GDAL.png -t_srs EPSG:3857 -ts 512 512 -te 15341217.324948 -5479006.187481 15497760.358876 -5322463.153553 -overwrite")
ahhhhhh this is because of #654 if you use 6.2.2 we get similar output
@Plantain I'm going to closes because it's related to #654
This was with 6.2.3post1, which I think is not affected by that issue? I think it's even worse again post 6.2.4, I will generate another sample from that.
On Thu, 14 Dec 2023, 6:01 pm Vincent Sarago, @.***> wrote:
Closed #662 https://github.com/cogeotiff/rio-tiler/issues/662 as completed.
— Reply to this email directly, view it on GitHub https://github.com/cogeotiff/rio-tiler/issues/662#event-11244760796, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACODF7Y4DNG5M4J7XR2LU3YJKW3XAVCNFSM6AAAAABAUBJ2P2VHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJRGI2DINZWGA3TSNQ . You are receiving this because you were mentioned.Message ID: @.***>
When I use rio-tiler directly on (space-projected) tiffs, the quality of the tiles is noticeably worse than if I first cut them to GoogleMapsCompatible COG's using gdal.
I think given GDAL is the backend of rasterio/rio-tiler, and it's cutting the same size output tiles, the result should be the same quality if not pixel-identical.
Data: http://static.skysight.io/rio-bug/orig.tiff Warp command: gdalwarp -multi -co TILED=YES -wo NUM_THREADS=64 -co BIGTIFF=YES -t_srs EPSG:3857 -of COG -co QUALITY=100 -co COMPRESS=JPEG -co TILING_SCHEME=GoogleMapsCompatible -co ZOOM_LEVEL=7 -co BLOCKSIZE=512 --config GDAL_TIFF_OVR_BLOCKSIZE 512 orig.tiff reproj.tiff
Code:
rio-tiler reprojected and extracted tile:![orig](https://github.com/cogeotiff/rio-tiler/assets/319895/dfd174f9-e3f8-474a-9fe5-3f021021f9fb)
gdal reprojected and rio-tiler extracted tile:![reproj](https://github.com/cogeotiff/rio-tiler/assets/319895/50a31d83-5d79-4f89-86c9-e41f89764138)
The difference is subtle but if you zoom right in, you can see the GDAL reprojected tile appears to have double(?) the vertical pixel resolution.
rio-tiler 6.2.3-post1 rasterio 1.3.9 but built with GDAL 3.8.1 GDAL 3.8.1 for the projection OSX 14.1.2