Topics

Do I need to warp jp2 satellite images for rasterio to manipulate them?

himat15@...
 

I have some .jp2 files that don't have a `.crs` property after I used `rio.open` on those files. 
I read https://gis.stackexchange.com/a/233417/143989 and after using the `.gcps` property, I was able to get the crs.

But, the second answer also suggested that I could use `gdalwarp` to embed the projection info in the raster directly.
My question is, do I need to do the `gdalwarp`? I don't know if not having the crs in the normal property will affect rasterio's ability to do other operations on the jp2 file raster such as transformations to change the cell size. Or will all rasterio operations work as normal with the jp2 file as it is?


Sean Gillies
 

Hi,

On Mon, Mar 9, 2020 at 2:05 PM himat15 via Groups.Io <himat15=yahoo.com@groups.io> wrote:
I have some .jp2 files that don't have a `.crs` property after I used `rio.open` on those files. 
I read https://gis.stackexchange.com/a/233417/143989 and after using the `.gcps` property, I was able to get the crs.

But, the second answer also suggested that I could use `gdalwarp` to embed the projection info in the raster directly.
My question is, do I need to do the `gdalwarp`? I don't know if not having the crs in the normal property will affect rasterio's ability to do other operations on the jp2 file raster such as transformations to change the cell size. Or will all rasterio operations work as normal with the jp2 file as it is?

I recommend warping. GCPs are not seamlessly supported throughout rasterio 1.1.3. For example, a dataset's window_bounds and window_transform methods are ignorant of the dataset's GCPs and their CRS.

--
Sean Gillies

himat15@...
 

What is the best way to do this warping?

Should I not actually warp and just set the `.crs` property of the jp2 raster and then re-save it in the same file?
Or should I warp it the crs, and then re-save as a .jp2 or should I save as a .tif?

Should I use virtual warping like here https://rasterio.readthedocs.io/en/latest/topics/virtual-warping.html
or should I use reprojection like here https://rasterio.readthedocs.io/en/latest/topics/reproject.html 

I just want to make sure I don't mess anything up, so thank you!