Skip to content

How to get the maximum overview level in a COG? #756

Answered by snowman2
rsignell asked this question in Q&A
Discussion options

You must be logged in to vote
import rasterio
import rioxarray

https_url = 'https://s3.us-west-2.amazonaws.com/prod-is-usgs-sb-prod-publish/618e83cad34ec04fc9caa715/South_Carolina_CoNED_Topobathy_DEM_1m.tif'

with rasterio.open(https_url) as rds:
    max_overview_level = len(rds.overviews(1)) - 1

da = rioxarray.open_rasterio(https_url, overview_level=max_overview_level)

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@snowman2
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by snowman2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants