Skip to content

How to open and clip raster data more efficiently when your clip data are in a different CRS #261

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

You must be logged in to vote

The crs kwarg represents the CRS input of the geometries and will handle reprojecting the geometries for you. rioxarray uses GDAL and geopandas uses pyproj to transform the points, so the speed/results may vary between the two methods.

Note:
rioxarray only re-projects the geometries if the CRS are not the same:

if self.crs != crs:
if LooseVersion(rasterio.__version__) >= LooseVersion("1.2"):
geometries = rasterio.warp.transform_geom(crs, self.crs, geometries)
else:
geometries = [
rasterio.warp.transform_geom(crs, self.crs, geometry)
for geometry in geometries
]

geopandas al…

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@lwasser
Comment options

@snowman2
Comment options

@snowman2
Comment options

@lwasser
Comment options

@lwasser
Comment options

Answer selected by lwasser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants