1

I have a raster that I read with rasterio

dataset = rasterio.open(f'{PATH}.tif')

The CRS is

epsg:4326

I want to know the pixel size of my raster. From the doc I know that res returns the (width, height) of pixels in the units of its coordinate reference system.

pixel_size_x, pixel_size_y = dataset.res

9.989276315832508e-07 9.972246695723605e-07

After googling I know that degrees is my unit. How can I express my pixel size in meters? If possible I want to prevent reprojecting the raster.

2
  • There is no exact conversion to meters from 4326 degrees. Neither the X nor Y dimension is fixed in planar units. Only an equal area projection has a hope of having uniform dimensions (and will require resampling to accomplish the conversion (affecting data quality).
    – Vince
    Commented Sep 2, 2022 at 12:17
  • If you assume a spherical earth model (instead of an ellipsoidal one) you can get a fairly good estimate by scaling according to some trigonometric function of the latitude (1 degree square at the equator is bigger than 1 degree square at the poles). A little more complexity can probably do it more precisely for the WGS84 ellipsoid model. Am pretty sure its been done, have a search and see what you can find.
    – Spacedman
    Commented Sep 2, 2022 at 13:23

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.