lazer.geo¶
Functions for routine geospatial operations.
get_fiona_drivers(writable_only=False)
¶
Returns a list of supported vector drivers for fiona.
Source code in lazer/geo.py
def get_fiona_drivers(writable_only: bool = False) -> list:
"""Returns a list of supported vector drivers for fiona."""
if writable_only:
drivers = []
for key, value in fio.supported_drivers.items():
if "w" in value:
drivers.append(key)
else:
drivers = list(fio.supported_drivers.keys())
return drivers
utm_zone(lon, lat)
¶
Computes the UTM zone and hemisphere based on a WGS84 (lat, lon) pair
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lon |
float |
longitude (x) in WGS-84 coordinates |
required |
lat |
float |
latitude (y) in WGS-84 coordinates |
required |
Returns:
Type | Description |
---|---|
(zone, hemisphere) |
[utm_zone (1-60), hemisphere (N/S)] |
Source code in lazer/geo.py
def utm_zone(lon: float, lat: float):
"""Computes the UTM zone and hemisphere based on a WGS84 (lat, lon) pair
Args:
lon: longitude (x) in WGS-84 coordinates
lat: latitude (y) in WGS-84 coordinates
Returns:
(zone, hemisphere): [utm_zone (1-60), hemisphere (N/S)]
"""
# zone is based on longitude, hemisphere on latitude
zone = int((np.floor((lon + 180) / 6) % 60) + 1)
hemisphere = "N" if lat >= 0.0 else "S"
return (zone, hemisphere)