lonlat_to_xy
cellseg_gsontools.lonlat_to_xy(lon, lat)
¶
Converts lon, lat coordinates to x, y coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lon |
Union[float, Sequence]
|
Longitude coordinate(s). |
required |
lat |
Union[float, Sequence]
|
Latitude coordinate(s). |
required |
Returns:
Type | Description |
---|---|
Tuple[Union[float, Sequence], Union[float, Sequence]]
|
Tuple[Union[float, Sequence], Union[float, Sequence]]: x, y coordinates. |
Examples:
>>> from shapely.geometry import Polygon
>>> from cellseg_gsontools import lonlat_to_xy
>>> poly = Polygon([(10, 10), (10, 0), (20, 10)])
>>> lon, lat = poly.exterior.coords.xy
>>> x, y = lonlat_to_xy(lon, lat)
>>> x, y
(array('d', [-48636.648, -57087.120, 1048636.648, -48636.648]),
array('d', [1109577.311, 0.0, 1109577.311, 1109577.311]))