Here I gathered a module for geospatial data processing.
Resamples a GeoTIFF image to a new resolution and extracts the pixel value at a specific coordinate.
tiff_file
(str
): Path to the input GeoTIFF file.coordinate
(tuple
): A tuple containing latitude and longitude coordinates in decimal degrees (lat, lon
).old_resolution_meters
(float
): The original pixel resolution in meters.new_resolution_meters
(float
): The desired new pixel resolution in meters.
value
(float or None
): The extracted pixel value at the specified coordinate in the resampled image. ReturnsNone
if the coordinate is out of bounds or if the extracted value isNaN
.
Determines the UTM (Universal Transverse Mercator) zone number based on a given longitude.
longitude
(float
): The longitude in decimal degrees.
zone_number
(int
): The UTM zone number corresponding to the provided longitude.
Computes the EPSG (European Petroleum Survey Group) code for a specific UTM zone and hemisphere.
utm_zone
(int
): The UTM zone number.hemisphere
(str
): Hemisphere identifier (N
for Northern orS
for Southern).
epsg_code
(int
): The EPSG code representing the UTM zone and hemisphere combination.
Extracts pixel values at specified coordinates from a GeoTIFF file.
tiff_file
(str
): Path to the input GeoTIFF file.coordinate
(tuple
): A tuple containing latitude and longitude coordinates in decimal degrees (lat, lon
).
values
(list
): A list of extracted pixel values at the specified coordinate. The list may contain one or more values, orNone
if the coordinate is out of bounds or if values are missing.
Applies the Lee filter to a specific window in a GeoTIFF file and extracts the filtered value at a given coordinate.
The Lee filter is a speckle reduction filter used in remote sensing to enhance image quality.
window_size
(int
): The size of the square window used for filtering. A larger window size may provide better filtering, but it can be computationally intensive.tiff_file
(str
): Path to the input GeoTIFF file.coordinate
(tuple
): A tuple containing latitude and longitude coordinates in decimal degrees (lat, lon
).
filtered_value
(float or None
): The filtered value at the specified coordinate after applying the Lee filter. ReturnsNone
if the coordinate is out of bounds.