Skip to content

Instantly share code, notes, and snippets.

@yuhangch
Created April 3, 2020 11:10
Show Gist options
  • Save yuhangch/5f3c389586899672a03c4ce2636cbd85 to your computer and use it in GitHub Desktop.
Save yuhangch/5f3c389586899672a03c4ce2636cbd85 to your computer and use it in GitHub Desktop.
Rasterio Hint
import mercantile
import rasterio
from rasterio.session import OSSSession
from rasterio.warp import transform_bounds
from rio_tiler import constants
with rasterio.open(prefix) as src:
bounds = transform_bounds(
src.crs, constants.WGS84_CRS, *src.bounds, densify_pts=21
)
mintile = mercantile.tile(bounds[0], bounds[3], 10)
maxtile = mercantile.tile(bounds[2], bounds[1], 10)
print(mintile,maxtile)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment