Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pyproj
- import rasterio as rio
- from pathlib import Path
- from shapely.geometry import box
- from shapely.ops import transform
- target_crs = pyproj.crs.CRS.from_epsg(28992)
- features = list()
- for fpath in Path("").glob("*.tif"):
- with rio.open(fpath, 'r') as src:
- proj = pyproj.Transformer.from_crs(src.crs, target_crs, always_xy=True).transform
- bbox = transform(proj, box(*src.bounds))
- features.append({"geometry": bbox, "source": fpath.stem})
- gdf = gpd.GeoDataFrame(features, crs=target_crs)
- gdf.to_file("")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement