Rob174 / detection_nappe_hydrocarbures_IMT_cefrem

0 stars 0 forks source link

Get the resolution of rasterio transform #4

Closed Rob174 closed 3 years ago

Rob174 commented 3 years ago

When opened with

with rasterio.open(path) as file_object:
    xres = file_object.transform[0]
    yres = file_object.transform[-4]

what is the unit of xres and yres ?

--> .... per px

Rob174 commented 3 years ago

From https://rasterio.readthedocs.io/en/latest/topics/georeferencing.html

""" The Affine object is a named tuple with elements a, b, c, d, e, f corresponding to the elements in the matrix equation below, in which a pixel’s image coordinates are x, y and its world coordinates are x', y'.:

| x' |   | a b c | | x |
| y' | = | d e f | | y |
| 1  |   | 0 0 1 | | 1 |

"""

Rob174 commented 3 years ago

From https://stackoverflow.com/questions/55666858/how-can-i-get-correct-distances-in-meters-from-st-distance-sp-package-in-r-u

""" EPSG 4326 is a lat-long reference system with a particular shape of ellipsoid earth. The coordinates are lat-long degrees. st_distance spots this and works out the great circle distance between points based on the ellipsoid. If you want the distance in decimal degrees then assign an NA CRS and you'll get unitless distances, which are the pythagorean distances in lat-long (and so very wrong in real terms near the poles, for example). """

Rob174 commented 3 years ago

From https://www.l3harrisgeospatial.com/docs/enviheaderfiles.html#:~:text=The%20ENVI%20header%20file%20contains,hdr.

"""[for field mapinfo] Lists geographic information in the following order:

Projection name Reference (tie point) pixel x location (in file coordinates) Reference (tie point) pixel y location (in file coordinates) Pixel easting Pixel northing x pixel size y pixel size Projection zone (UTM only) North or South (UTM only) Datum Units

"""

Rob174 commented 3 years ago

The order of magnitude of the resolution is around 10 meters per pixel (for the GRD IW data), but there are some differences for the preprocessed data. The final range of resolutions is between 10 and 16 meters per pixel.

Rob174 commented 3 years ago

Note : reference coordinates system used here : https://epsg.io/4326 ; simple GPS

Rob174 commented 3 years ago

The resolution will slightly changed depending of the latitude and longitude

If we can approximate the earth by a sphere we have rmeters = RT thetaRad

Rob174 commented 3 years ago

We have several values that are suspected to be the resolution but each of them concretely correspond to uncoherent distance values:

map info = {Geographic Lat/Lon,9354.5,5329.0,25.488037187588098,38.88888297445375,1.7966305682390424E-4,1.7966305682390424E-4,WGS84,units=Degrees}

or

coordinate system string = {GEOGCS["WGS84(DD)", DATUM["WGS84", SPHEROID["WGS84", 6378137.0, 298.257223563]], PRIMEM["Greenwich", 0.0], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH]]}

| 0.00017966305682390432,-0.00, 23.71| |-0.00,-0.00017966305682390432, 40.39| | 0.00, 0.00, 1.00|

But if we take the approximation that the earth is a sphere, we can compute the corresponding distance with

We obtain
Rob174 commented 3 years ago

In the same order of magnitude as 10-16 meters. So we will use the transform value as it is in the .img file

Rob174 commented 3 years ago

To be checked with QGIS: 19.97 ~ 20 m / px for each example of image

Rob174 commented 3 years ago

Along x axis (lon) 15.50m /px on qgis