cogeotiff / rio-cogeo

Cloud Optimized GeoTIFF creation and validation plugin for rasterio
https://cogeotiff.github.io/rio-cogeo/
BSD 3-Clause "New" or "Revised" License
310 stars 42 forks source link

Reproject option #210

Closed ashnair1 closed 3 years ago

ashnair1 commented 3 years ago

Didn't rio-cogeo have a reproject option? Is it still possible to do this? I'm aware the --web-optimized flag allows creation of cog tiffs with the 3857 projection. But I'd like to convert to EPSG:4326.

vincentsarago commented 3 years ago

@ashnair1 there is not retroject option. We could maybe add one but the code is already quite complex. If you are using rio-cogeo api directly you could easily do something like

from rio_cogeo import cog_translate, cog_profiles
from rasterio.vrt import WarpedVRT
import rasterio

prof = cog_profiles.get("jpeg")

with rasterio.open("my.tif") as src:
    with WarpedVRT(src, crs="epss:4326") as vrt:
         cog_translate(vrt, "out.tif", prof, ....)
ashnair1 commented 3 years ago

Ah ok thanks.