Hi everyone,
I have two identical rasters, i use extent to put them on the same lower left corner but they havent the same shape. I want to get the size of my first raster to apply to my second.
Do you have any idea ?
Thank You.
I think i find what i was looking for, thank you guys for answering me.
i get 10 with this
Paul, next time, include the script you are using in your posts to help for provide targeted answers.
Yes, in fact i would like to change xcell and ycell with the input cell size of my first raster.
When converting back you have options for lower left corner, cell size and nodata values
NumPyArrayToRaster (in_array, {lower_left_corner}, {x_cell_size}, {y_cell_size}, {value_to_nodata})
NumPyArrayToRaster—Help | ArcGIS Desktop
In fact this is the same raster, but i did some processing on it.
I use arcpy.RasterToNumPyArray to use it like an array and finally i made the opposit way with arcpy.NumPyArrayToRaster.
But the default parameter for cell size is 1. I lose the cell size of my first raster.
I got this :
Hi Paul,
What type of rasters are you working with (i.e. .TIF)? Check to see if the raster that is in the correct location contains a .aux.xml file in File Explorer. You can try copying this file and renaming it the identical raster.
As Xander indicates, they may differ in other ways, like cell size,
The rows and columns must also match. If they don't then you will have to use a Resample to replicate those.
If can get messy with a combination of extent, snap raster and sampling.
Outlining the purpose of what you are doing may lead to alternate procedures (ie using numpy)
So you have two identical rasters but they don't have the same shape? Sounds like they are not completely identical. Can you explain how the shapes differ? Are the extents the same, but the resolution (cell size and therefore rows and columns) of the rasters different? Why do you want to do this with Python (do you have a number of rasters to process in the same way?
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.