get_point_coordinates¶
- pyhelpers.geom.get_point_coordinates(pt)[source]¶
Extracts (x, y) coordinates from a point-like object.
Supported types include Shapely Points, lists, tuples, and NumPy arrays.
- Parameters:
pt (shapely.geometry.Point | list | tuple | numpy.ndarray) – A point-like object containing at least two coordinates.
- Returns:
A tuple of (x, y) coordinates.
- Return type:
tuple[float, float]
- Raises:
ValueError – If the input format is unrecognized or has insufficient length.
Examples:
>>> from pyhelpers.geom import get_point_coordinates >>> from shapely.geometry import Point >>> get_point_coordinates(Point(1.0, 2.0)) (1.0, 2.0) >>> get_point_coordinates([1.5, 2.5, 0.0]) (1.5, 2.5)