pyufunc.get_coordinates_from_geom#
- pyufunc.get_coordinates_from_geom(geom_obj)#
Get the coordinates from a geometry object.
- Parameters:
geom_obj (Union[Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, GeometryCollection]) – The geometry object.
- Returns:
the coordinates of the geometry object in the format of numpy.ndarray
- Return type:
np.ndarray
Example
>>> from shapely.geometry import Point >>> pt = Point(0, 0) >>> get_coordinates_from_geom(pt) array([[0., 0.]])
>>> from shapely.geometry import LineString >>> line = LineString([(0, 0), (1, 1)]) >>> get_coordinates_from_geom(line) array([[0., 0.], [1., 1.]])
>>> from shapely.geometry import Polygon >>> poly = Polygon([(0, 0), (1, 1), (1, 0)]) >>> get_coordinates_from_geom(poly) array([[0., 0.], [1., 1.], [1., 0.], [0., 0.]])
Note
- This function is modified from the original code available at:
It returns the coordinates of the geometry object in the format of numpy.ndarray.