sentinelhub.geo_utils
Module for manipulation of geographical information
- sentinelhub.geo_utils.bbox_to_dimensions(bbox, resolution)[source]
Calculates width and height in pixels for a given bbox of a given pixel resolution (in meters). The result is rounded to the nearest integers.
- Parameters:
- Returns:
width and height in pixels for given bounding box and pixel resolution
- Return type:
- sentinelhub.geo_utils.bbox_to_resolution(bbox, width, height, meters=True)[source]
Calculates pixel resolution for a given bbox of a given width and height. By default, it returns result in meters.
- Parameters:
- Returns:
resolution east-west at north and south, and resolution north-south for given CRS
- Raises:
ValueError if CRS is not supported
- Return type:
- sentinelhub.geo_utils.get_image_dimension(bbox, width=None, height=None)[source]
Given bounding box and one of the parameters width or height it will return the other parameter that will best fit the bounding box dimensions
- sentinelhub.geo_utils.get_utm_bbox(img_bbox, transform)[source]
Get UTM coordinates given a bounding box in pixels and a transform
- Parameters:
- Returns:
UTM coordinates as [east1, north1, east2, north2]
- Return type:
- sentinelhub.geo_utils.wgs84_to_utm(lng, lat, utm_crs=None)[source]
Convert WGS84 coordinates to UTM. If UTM CRS is not set it will be calculated automatically.
- sentinelhub.geo_utils.to_wgs84(east, north, crs)[source]
Convert any CRS with (east, north) coordinates to WGS84
- sentinelhub.geo_utils.utm_to_pixel(east, north, transform, truncate=True)[source]
Convert a UTM coordinate to image coordinate given a transform
- Parameters:
- Returns:
row and column pixel image coordinates
- Return type:
- sentinelhub.geo_utils.pixel_to_utm(row, column, transform)[source]
Convert pixel coordinate to UTM coordinate given a transform
- sentinelhub.geo_utils.wgs84_to_pixel(lng, lat, transform, utm_epsg=None, truncate=True)[source]
Convert WGS84 coordinates to pixel image coordinates given transform and UTM CRS. If no CRS is given it will be calculated it automatically.
- Parameters:
lng (float) – longitude of point
lat (float) – latitude of point
transform (Sequence[float]) – georeferencing transform of the image, e.g. (x_upper_left, res_x, 0, y_upper_left, 0, -res_y)
utm_epsg (CRS | None) – UTM coordinate reference system enum constants
truncate (bool) – Whether to truncate pixel coordinates. Default is True
- Returns:
row and column pixel image coordinates
- Return type:
- sentinelhub.geo_utils.get_utm_crs(lng, lat, source_crs=CRS.WGS84)[source]
Get CRS for UTM zone in which (lat, lng) is contained.