I have a GeoTIFF raster file in the EPSG 4326 (WGS 84) geographic coordinate system.
I want to crop a 20 km x 20 km square around a particular (lat, long) coordinate, and save that as a new raster.
But since the units for my image are in lat long degrees, but I want a box in terms of kilometers, is the best way to do this to use the Haversine formula to convert my (lat, long) degrees to coordinates in meters, compute the bounding box in meters, and then invert the Haversine computation to get back the box in degrees?
OR do I just project the entire image into a projected coordinate system, so that I can then easily find the bounding box in meters, and then re-project all the bounding box coords back into degrees in my original geographic coordinate system?
Is there any difference in accuracy when doing this? I understand that using Haversine may not be that accurate, but it seems to me that projecting would also lose some accuracy?
(I'm doing this in Python with rasterio or GDAL if that makes a difference.)
My data is around lon: -120.011597902, lat: 39.54719334000001
Resolution (cell size): 0.0035 deg/pixel
- I think this is around 300 meters/pixel (not sure).