RSGISLib UTM Tools
EPSG
- rsgislib.tools.utm.epsg_for_utm(zone: int, hemisphere: str) int
Return EPSG code for given UTM zone and hemisphere using WGS84 datum.
- Parameters:
zone – UTM zone
hemisphere – hemisphere either ‘N’ or ‘S’
- Returns:
corresponding EPSG code
- rsgislib.tools.utm.utm_from_epsg(epsg_code: int) -> (<class 'int'>, <class 'str'>)
Return UTM zone and hemisphere from a EPSG code using WGS84 datum.
- Parameters:
epsg_code – epsg code for the UTM projection.
- Returns:
zone, hemisphere
Validity
- rsgislib.tools.utm.check_valid_zone(zone_number: int, zone_letter: str = None, use_exp: bool = False) bool
Check that the UTM zone is valid.
- Parameters:
zone_number – int for the UTM zone
zone_letter – string for the zone letter.
use_exp – If True then an exception will be thrown if the zone is invalid if False (default) then a boolean value of False will be returned by the function if zone is not valid.
- Returns:
True if zone is valid and Falsei if not.
Lat / Lon to UTM
- rsgislib.tools.utm.from_latlon(latitude: ~numpy.array, longitude: ~numpy.array, force_zone_number: int = None, force_zone_letter: str = None) -> (<built-in function array>, <built-in function array>, <built-in function array>, <built-in function array>)
This function convert Latitude and Longitude to UTM coordinate
- Parameters:
latitude – float or array. Latitude between 80 deg S and 84 deg N, e.g. (-80.0 to 84.0)
longitude – float or array: Longitude between 180 deg W and 180 deg E, e.g. (-180.0 to 180.0).
number (force_zone) – int: Zone Number is represented with global map numbers of an UTM Zone Numbers Map. You may force conversion including one UTM Zone Number. More information see http://www.jaworski.ca/utmzones.htm
- Returns:
eastings, northings, zone_number, zone_letter
- rsgislib.tools.utm.to_latlon(easting, northing, zone_number, zone_letter=None, northern=None, strict=True)
This function convert an UTM coordinate into Latitude and Longitude
- Parameters:
easting – int or array: Easting value of UTM coordinate
northing – int or array: Northing value of UTM coordinate
number (zone) – int: Zone Number is represented with global map numbers of an UTM Zone Numbers Map. More information see http://www.jaworski.ca/utmzones.htm
zone_letter – str: Zone Letter can be represented as string values. Where UTM Zone Designators can be accessed in http://www.jaworski.ca/utmzones.htm
northern – bool: You can set True or False to set this parameter. Default is None
- rsgislib.tools.utm.latitude_to_zone_letter(latitude)
Find the zone letter for the latitude. If the input is a numpy array, just use the first element user responsibility to make sure that all points are in one zone
- Parameters:
latitude –
- Returns:
string if found otherwise None.
- rsgislib.tools.utm.latlon_to_zone_number(latitude, longitude)
Find the UTM zone number for a give latitude and longitude. If the input is a numpy array, just use the first element user responsibility to make sure that all points are in one zone
- Parameters:
latitude – float
longitude – float
- Returns:
int
- rsgislib.tools.utm.min_max_eastings_for_lat(latitude: float, zone: int = 1) -> (<class 'float'>, <class 'float'>)
Find the minimum and maximum Eastings for a specified latitude within a specific zone. This should be the same for all zones.
- Parameters:
latitude – float
zone – int
- Returns:
tuple [min, max]
- rsgislib.tools.utm.latlon_arr_to_utm_zone_number(latitude: array, longitude: array) array
Find the UTM zone number for a give latitude and longitude. UTM zone will be returned for all the lat/longs within the input arrays, which must be of the same length. Function will also work with a single value, at which point a single int will be returned.
- Parameters:
latitude – numpy array of floats
longitude – numpy array of floats
- Returns:
int or array of ints.
- rsgislib.tools.utm.latlon_to_mode_utm_zone_number(latitude: array, longitude: array) int
Find the mode UTM zone for a list of lat/lon values.
- Parameters:
latitude – numpy array of floats
longitude – numpy array of floats
- Returns:
int (mode UTM zone)
- rsgislib.tools.utm.zone_number_to_central_longitude(zone_number: int) int
Find the central longitude for the given zone.
- Parameters:
zone_number – int
- Returns:
float
- rsgislib.tools.utm.split_wgs84_bbox_utm_zones(wgs84_bbox)
Function which splits a bounding box (MinX, MaxX, MinY, MaxY) into a number of small bounding boxes (MinX, MaxX, MinY, MaxY) at UTM zone boundaries.
- Parameters:
wgs84_bbox – bounding box in lat/long WGS84 (MinX, MaxX, MinY, MaxY)
- Returns:
list [utm zone, bbox]