2

Below is gdalinfo of my GeoTIFF file.

It states that pixel size is 30.079329235631686.

However, (1093938.512-837903.262)/8512=30.0793291823308 which translates to the difference of 0.000000053300759361718500.

What is the right way to calculate the pixel size?

Size is 8512, 8622
Coordinate System is:
PROJCS["WGS 84 / UTM zone 31N",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",3],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","32631"]]
Origin = (837903.261500865690000,5877808.477226150200000)
Pixel Size = (30.079329235631686,-30.079329235631686)
Metadata:
  AREA_OR_POINT=Point
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  837903.262, 5877808.477) (  8d 1'48.79"E, 52d56'35.71"N)
Lower Left  (  837903.262, 5618464.501) (  7d46'39.67"E, 50d37'11.83"N)
Upper Right ( 1093938.512, 5877808.477) ( 11d48'11.42"E, 52d43'20.22"N)
Lower Right ( 1093938.512, 5618464.501) ( 11d21'56.03"E, 50d24'59.35"N)
Center      (  965920.887, 5748136.489) (  9d44'38.52"E, 51d41'24.52"N)
Band 1 Block=8512x1 Type=UInt16, ColorInterp=Gray
  • 2
    Isnt the pixel size in meters? Why do you care about a difference of 53 nanometers? – BERA Jun 7 '17 at 7:13
  • I care mostly not about the precision but about the method of calculation. I would like to calculate pixel size in a software. Thus, I need to be sure that my calculation method is the same as gdalinfo. – Antonio Jun 7 '17 at 10:08
5

That your numbers differ are because of different precisions. Your pixel size has 15 decimals. Your calculation uses a bounding box with 3 decimals.

Just two sidenotes on the topic:

You can´t calculate the pixel size to the accuracy you may be hoping for. You have different length distortions depending on the location. In UTM zones this reaches up to 0,1% at the borders to the next zone. And your difference is at the 8th decimal... Also there are deviations from rotation and scaling.

That means that you do not have an exact pixel size anyway. Of course when you create a raster you set a size like exact 30m. But that also differs whenever you transform it or cut something from it. There it depends on your transformation and interpolation when the new raster is created. Its no excact science to such (unnecessary) precisions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.