Skip to content
","upvoteCount":1,"answerCount":3,"acceptedAnswer":{"@type":"Answer","text":"

Re-project match just uses the same CRS, transform, and shape of the other raster:
\n

\n
\n

\n rioxarray/rioxarray/raster_array.py\n

\n

\n Line 552\n in\n 6b768ec\n

\n
\n
\n \n\n \n \n \n \n
reprojected_data_array = self.reproject(
\n
\n
\n

\n

Examples referenced in solution:

\n\n

Solution:

\n
import rasterio\nimport rasterio.vrt\nimport rioxarray\n\nwith rasterio.open(\"large.tif\") as src, rasterio.open(\"template_large.tif\") as template:\n        with rasterio.vrt.WarpedVRT(\n            src,\n            crs=template.crs,\n            transform=template.transform,\n            height=template.height,\n            width=template.width,\n        ) as vrt:\n            rds = rioxarray.open_rasterio(vrt, lock=False, parse_coordinates=False)\n            rds.rio.to_raster(\"output.tif\", tiled=True, windowed=True)
","upvoteCount":1,"url":"https://github.com/corteva/rioxarray/discussions/757#discussioncomment-8801528"}}}

Re-project match with a large raster #757

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

You must be logged in to vote

Re-project match just uses the same CRS, transform, and shape of the other raster:

reprojected_data_array = self.reproject(

Examples referenced in solution:

Solution:

import rasterio
import rasterio.vrt
import rioxarray

with rasterio.open("large.tif") as src, rasterio.open("template_large.tif") as template:
        with rasterio.vrt.WarpedVRT(
            src,
            crs=template.crs,
            transform=template.transform,
            height=template.height,
            width=template.width,
        ) as vrt:
            rds = rioxarray.open_rasterio(vrt

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
5 replies
@JimShady
Comment options

@JimShady
Comment options

@JimShady
Comment options

@snowman2
Comment options

@JimShady
Comment options

Answer selected by JimShady
Comment options

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

Comment options

You must be logged in to vote
0 replies
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