Geos DataFrame Accessor#
- class pgpd.GeosDataFrameAccessor(obj)#
Access Shapely functionality through the “geos” dataframe accessor keyword. The functions defined here simply call the appropriate functions from
GeosSeriesAccessor
and group the results.Example
>>> df = pd.DataFrame({ ... 'a': list('abcde'), ... 'poly': shapely.box(range(5), 0, range(10,15), 10), ... 'pt': shapely.points(range(5), range(10,15)) ... }) >>> df = df.astype({'poly':'geos', 'pt':'geos'}) >>> df a poly pt 0 a POLYGON ((10 0, 10 10, 0 10, 0 0, 10 0)) POINT (0 10) 1 b POLYGON ((11 0, 11 10, 1 10, 1 0, 11 0)) POINT (1 11) 2 c POLYGON ((12 0, 12 10, 2 10, 2 0, 12 0)) POINT (2 12) 3 d POLYGON ((13 0, 13 10, 3 10, 3 0, 13 0)) POINT (3 13) 4 e POLYGON ((14 0, 14 10, 4 10, 4 0, 14 0)) POINT (4 14) >>> df.geos.has_z() poly pt 0 False False 1 False False 2 False False 3 False False 4 False False
Serialization#
Serialization & Deserialization functionality.
Transform a |
|
Transform a pandas DataFrame with (at least) a "geos" dtype column to a |
|
Geometry#
Methods from Shapely Geometry Properties.
Returns the dimensionality of the coordinates in a geometry (2 or 3). |
|
Returns the inherent dimensionality of a geometry. |
|
Returns the exterior ring of a polygon. |
|
Returns the nth geometry from a collection of geometries. |
|
Returns the nth interior ring of a polygon. |
|
Returns the total number of coordinates in a geometry. |
|
Returns number of geometries in a collection. |
|
Returns number of internal rings in a polygon |
|
Returns number of points in a linestring or linearring. |
|
Returns the nth point of a linestring or linearring. |
|
Get the precision of a geometry. |
|
Returns the SRID of a geometry. |
|
Returns the type ID of a geometry. |
|
Returns the x-coordinate of a point |
|
Returns the y-coordinate of a point |
|
Returns the z-coordinate of a point. |
|
Forces the dimensionality of a geometry to 2D. |
|
Forces the dimensionality of a geometry to 3D. |
|
Returns geometry with the precision set to a precision grid size. |
|
Returns a geometry with its SRID set. |
Geometry Creation#
Methods from Shapely Geometry Creation.
Destroy the prepared part of a geometry, freeing up memory. |
|
Prepare a geometry, improving performance of other operations. |
Measurement#
Methods from Shapely Measurement.
Computes the area of a (multi)polygon. |
|
Computes the length of a (multi)linestring or polygon perimeter. |
|
Computes the radius of the minimum bounding circle that encloses an input geometry. |
|
Computes the Minimum Clearance distance. |
|
Computes the total bounds (extent) of the geometry. |
Predicates#
Methods from Shapely Predicates.
Returns True if a geometry has a Z coordinate. |
|
Returns True if a linestring or linearring is counterclockwise. |
|
Returns True if a linestring's first and last points are equal. |
|
Returns True if a geometry is an empty point, polygon, etc. |
|
Returns True if the object is a geometry |
|
Returns True if the object is not a geometry (None) |
|
Returns True if a Geometry is prepared. |
|
Returns True if a linestring is closed and simple. |
|
Returns True if a Geometry has no anomalous geometric points, such as self-intersections or self tangency. |
|
Returns True if a geometry is well formed. |
|
Returns True if the object is a geometry or None |
|
Returns a string stating if a geometry is valid and if not, why. |
Constructive Operations#
Methods from Shapely Constructive Operations.
Returns the topological boundary of a geometry. |
|
Computes the buffer of a geometry for positive and negative buffer distance. |
|
Computes the geometric center (center-of-mass) of a geometry. |
|
Returns the portion of a geometry within a rectangle. |
|
Computes the minimum convex geometry that encloses an input geometry. |
|
Computes a Delaunay triangulation around the vertices of an input geometry. |
|
Computes the minimum bounding box that encloses an input geometry. |
|
Returns all distinct vertices of an input geometry as a multipoint. |
|
Repairs invalid geometries. |
|
Computes the minimum bounding circle that encloses an input geometry. |
|
Computes the oriented envelope (minimum rotated rectangle) that encloses an input geometry, such that the resulting rectangle has minimum area. |
|
Converts Geometry to normal form (or canonical form). |
|
Returns a (Multi)LineString at a distance from the object on its right or its left side. |
|
Computes the oriented envelope (minimum rotated rectangle) that encloses an input geometry, such that the resulting rectangle has minimum area. |
|
Returns a point that intersects an input geometry. |
|
Returns a copy of a Geometry with the order of coordinates reversed. |
|
Returns a simplified version of an input geometry using the Douglas-Peucker algorithm. |
|
Snaps an input geometry to reference geometry's vertices. |
|
Computes a Voronoi diagram from the vertices of an input geometry. |
Linestring Operations#
Methods from Shapely Linestring Operations.
Returns a point interpolated at given distance on a line. |
|
Returns the distance to the line origin of given point. |
|
Returns (Multi)LineStrings formed by combining the lines in a MultiLineString. |
Coordinate Operations#
Methods from Shapely Coordinate Operations.
Returns a copy of a geometry array with a function applied to its coordinates. |
|
Counts the number of coordinate pairs in a geometry array. |
|
Adapts the coordinates of a geometry array in-place. |
Custom#
Custom methods to add more functionality.
Performs a 2D or 3D affine transformation on all the coordinates. |
|
Performs a 2D or 3D rotation on all the coordinates. |
|
Performs a 2D or 3D scaling on all the coordinates. |
|
Performs a 2D or 3D skew/shear transformation on all the coordinates. |
|
Performs a 2D or 3D translation on all the coordinates. |