geopandas.GeoSeries.representative_point#

GeoSeries.representative_point()[source]#

Returns a GeoSeries of (cheaply computed) points that are guaranteed to be within each geometry.

See also

GeoSeries.centroid

geometric centroid

Examples

>>> from shapely.geometry import Polygon, LineString, Point
>>> s = geopandas.GeoSeries(
...     [
...         Polygon([(0, 0), (1, 1), (0, 1)]),
...         LineString([(0, 0), (1, 1), (1, 0)]),
...         Point(0, 0),
...     ]
... )
>>> s
0    POLYGON ((0.00000 0.00000, 1.00000 1.00000, 0....
1    LINESTRING (0.00000 0.00000, 1.00000 1.00000, ...
2                              POINT (0.00000 0.00000)
dtype: geometry
>>> s.representative_point()
0    POINT (0.25000 0.50000)
1    POINT (1.00000 1.00000)
2    POINT (0.00000 0.00000)
dtype: geometry