-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue in Merging/Mosaicing multiple images using Rioxarray Python #172
Comments
@rrsc1234 are you able to share the input files? That would be the easiest way to be able to assist. |
I notice that you aren't using |
@snowman2 . Here is the link to the input datasets: |
I see that you have both You need to change: for val in items:
elements.append(rioxarray.open_rasterio(val)) to: for val in items:
rds = rioxarray.open_rasterio(val)
if rds.crs != "EPSG:32643":
rds = rds.rio.reproject("EPSG:32643")
elements.append(rds) |
@snowman2 . Thanks for your suggestion. Your solution worked for me. |
Glad to hear that it worked 👍 |
With fix in #183, targeted for the 0.2 release, this will be managed automatically. |
Will this work for datasets opened with xarray? I tried to reproject a dataset into an adjacent UTM zone and the resulting grid was not aligned. |
If you are using the latest |
Hi. I am using the following code to mosaic/merge 10 image files (.tif files) inside a folder using the following code:
`
import rioxarray
from rioxarray import merge
from rasterio.plot import show
items = [r'D:\LC08_L1TP_146046_20180425_20180502_01_T1.tif',
r'D:\LE07_L1TP_145045_20180426_20180523_01_T1.tif',
r'D:\LC08_L1TP_144046_20180427_20180502_01_T1.tif',
r'D:\LC08_L1TP_144045_20180427_20180502_01_T1.tif',
r'D:\LC08_L1TP_143046_20180420_20180502_01_T1.tif',
r'D:\LC08_L1TP_143047_20180420_20180502_01_T1.tif',
r'D:\LC08_L1TP_143045_20180420_20180502_01_T1.tif',
r'D:\LE07_L1TP_145046_20180426_20180523_01_T1.tif',
r'D:\LE07_L1TP_145045_20180426_20180523_01_T1.tif',
r'D:\LC08_L1TP_144047_20180427_20180502_01_T1.tif']
elements = []
for val in items:
elements.append(rioxarray.open_rasterio(val))
merged = merge.merge_arrays(elements, nodata=0.0)
image = merged.values
show(image)
`
After running the above code I am getting the following output:
When I am loading all the input files (for mosaic/merge) in ArcMap, I am getting the following:
From the above 2 images it is observed that the mosaic image obtained after running the above code is flipped (left part and right side are swapped).
Can someone please let me know how to solve this issue.
I am attaching the link to the input files:
https://drive.google.com/file/d/1hF5pb8MojW-N5l9xMgd1mJ95CtjLa8wQ/view?usp=sharing
The text was updated successfully, but these errors were encountered: