from sedona.spark.geopandas import GeoDataFrame
GeoDataFrame(
data=None,
index=None,
columns=None,
dtype=None,
copy=False,
geometry: Any | None = None,
crs: Any | None = None,
**kwargs,
)
Parameters
dict, array-like, DataFrame, or GeoDataFrame
default:"None"
Data to initialize the GeoDataFrame. Can be a dictionary, array-like structure,
pandas DataFrame, GeoPandas GeoDataFrame, or another GeoDataFrame.
Index or array - like
default:"None"
Index to use for the resulting frame.
Index or array - like
default:"None"
Column labels to use for the resulting frame.
default:"None"
default:"False"
Any | None
default:"None"
Column name, array of geometries, or GeoSeries to use as the active geometry.
If None, will look for existing geometry columns.
Any | None
default:"None"
Coordinate Reference System for the geometries.
This implementation differs from GeoPandas in several ways:
- Uses Spark for distributed processing
- Geometries are stored in WKB (Well-Known Binary) format internally
- Some methods may have different performance characteristics
- Not all GeoPandas methods are implemented yet (see Sedona GeoPandas docs).
- Operations are distributed across Spark cluster
- Avoid converting to GeoPandas (.to_geopandas()) on large datasets
- Use .sample() for testing with large datasets
- Spatial joins are optimized for distributed processing
- Supports multiple geometry columns
- One geometry column is designated as ‘active’ at a time
- Active geometry is used for spatial operations and plotting
- Use set_geometry() to change the active geometry column
geopandas.GeoDataFrame: The GeoPandas equivalentsedona.spark.geopandas.GeoSeries: Series with geometry data
Examples
>>> from shapely.geometry import Point, Polygon
>>> from sedona.spark.geopandas import GeoDataFrame
>>> import pandas as pd
>>>
>>> # Create from dictionary with geometry
>>> data = {
... 'name': ['A', 'B', 'C'],
... 'geometry': [Point(0, 0), Point(1, 1), Point(2, 2)]
... }
>>> gdf = GeoDataFrame(data, crs='EPSG:4326')
>>> gdf
name geometry
0 A POINT (0 0)
1 B POINT (1 1)
2 C POINT (2 2)
>>>
>>> # Spatial operations
>>> buffered = gdf.buffer(0.1)
>>> buffered.area
0 0.031416
1 0.031416
2 0.031416
dtype: float64
>>>
>>> # Spatial joins
>>> polygons = GeoDataFrame({
... 'region': ['Region1', 'Region2'],
... 'geometry': [
... Polygon([(-1, -1), (1, -1), (1, 1), (-1, 1)]),
... Polygon([(0.5, 0.5), (2.5, 0.5), (2.5, 2.5), (0.5, 2.5)])
... ]
... })
>>> result = gdf.sjoin(polygons, how='left', predicate='within')
>>> result['region']
0 Region1
1 Region2
2 Region2
dtype: object
Properties
| Name | Description |
|---|---|
active_geometry_name | Return the name of the active geometry column |
area | Returns a Series containing the area of each geometry in the GeoSeries expressed in the units of the CRS. |
boundary | Returns a GeoSeries of lower dimensional objects representing each geometry’s set-theoretic boundary. |
bounds | Returns a DataFrame with columns minx, miny, maxx, maxy values containing the bounds for each geometry. |
centroid | Returns a GeoSeries of points representing the centroid of each geometry. |
convex_hull | Return a GeoSeries of geometries representing the convex hull of each geometry. |
crs | |
cx | Select geometries that intersect a coordinate bounding box. |
envelope | Returns a GeoSeries of geometries representing the envelope of each geometry. |
exterior | Return the outer boundary of each polygon geometry. |
geom_type | Returns a series of strings specifying the geometry type of each geometry of each object. |
has_m | Return a Series of dtype(‘bool’) with value True for features that have an m-component. |
has_sindex | Check the existence of the spatial index without generating it. |
has_z | Returns a Series of dtype(‘bool’) with value True for features that have a z-component. |
interiors | Return a Series of lists containing polygon interior rings. |
is_ccw | Return a Series of dtype(‘bool’) with value True if a LineString or LinearRing is counter-clockwise. |
is_closed | Return a Series of dtype(‘bool’) with value True if a LineString’s or LinearRing’s first and last points are equal. |
is_empty | Returns a Series of dtype(‘bool’) with value True for empty geometries. |
is_ring | Return a Series of dtype(‘bool’) with value True for features that are closed. |
is_simple | Returns a Series of dtype(‘bool’) with value True for geometries that do not cross themselves. |
is_valid | Returns a Series of dtype(‘bool’) with value True for geometries that are valid. |
length | Returns a Series containing the length of each geometry in the GeoSeries. |
sindex | Returns a spatial index for the GeoSeries. |
total_bounds | Returns a tuple containing minx, miny, maxx, maxy values for the bounds of the series as a whole. |
type | Return the geometry type of each geometry in the GeoSeries. |
unary_union | Returns a geometry containing the union of all geometries in the GeoSeries. |
Methods
| Name | Description |
|---|---|
affine_transform | Return a GeoSeries with transformed geometries. |
buffer | Returns a GeoSeries with all geometries buffered by the specified distance. |
build_area | Create an areal geometry formed by the constituent linework. |
clip | Clip geometries to a polygonal or rectangular mask. |
clip_by_rect | Returns a GeoSeries of the portions of geometry within the given rectangle. |
concave_hull | Return a GeoSeries of geometries representing the concave hull of vertices of each geometry. |
constrained_delaunay_triangles | Return the constrained Delaunay triangulation of each polygon. |
contains | Returns a Series of dtype(‘bool’) with value True for each aligned geometry that contains other. |
contains_properly | Returns a Series of dtype(‘bool’) with value True for each aligned geometry that properly contains other. |
copy | Make a copy of this GeoDataFrame object. |
count_coordinates | Return a Series of dtype(‘int’) with the number of coordinate tuples in each geometry. |
count_geometries | Return a Series of dtype(‘int’) with the number of geometries in each multi-geometry or geometry collection. |
count_interior_rings | Return a Series of dtype(‘int’) with the number of interior rings (holes) in each polygon geometry. |
covered_by | Returns a Series of dtype(‘bool’) with value True for each aligned geometry that is entirely covered by other. |
covers | Returns a Series of dtype(‘bool’) with value True for each aligned geometry that is entirely covering other. |
crosses | Returns a Series of dtype(‘bool’) with value True for each aligned geometry that cross other. |
delaunay_triangles | Return Delaunay triangulation of the vertices of each geometry. |
difference | Returns a GeoSeries of the points in each aligned geometry that are not in other. |
disjoint | Returns a Series of dtype(‘bool’) with value True for each aligned geometry that is disjoint from other. |
dissolve | Dissolve geometries within groups using distributed aggregation. |
distance | Returns a Series containing the distance to aligned other. |
dwithin | Returns a Series of dtype(‘bool’) with value True for each aligned geometry that is within a set distance from other. |
estimate_utm_crs | Return the estimated UTM CRS based on the bounds of the dataset. |
explode | Explode multi-part geometries into separate rows. |
extract_unique_points | Return a GeoSeries of MultiPoints representing all distinct vertices of each geometry. |
force_2d | Force the dimensionality of a geometry to 2D. |
force_3d | Force the dimensionality of a geometry to 3D. |
frechet_distance | Returns a Series containing the discrete Fréchet distance to aligned other. |
from_arrow | Construct a GeoDataFrame from a Arrow table object based on GeoArrow extension types. |
from_dict | Construct a GeoDataFrame from a dictionary. |
from_features | Construct a GeoDataFrame from GeoJSON-like features. |
from_file | Alternate constructor to create a GeoDataFrame from a file. |
geom_equals | Returns a Series of dtype(‘bool’) with value True for each aligned geometry equal to other. |
geom_equals_exact | Return True for geometries that equal aligned other to a given tolerance, otherwise False. |
geom_equals_identical | Return True for geometries that are identical to aligned other, otherwise False. |
get_coordinates | Get coordinates as a distributed pandas-on-Spark DataFrame. |
get_geometry | Returns the n-th geometry from a collection of geometries (0-indexed). |
hausdorff_distance | Returns a Series containing the Hausdorff distance to aligned other. |
hilbert_distance | Calculate the distance along a Hilbert curve. |
interpolate | Return a point at the specified distance along each geometry. |
intersection | Returns a GeoSeries of the intersection of points in each aligned geometry with other. |
intersection_all | Returns a geometry containing the intersection of all geometries in the GeoSeries. |
intersects | Returns a Series of dtype(‘bool’) with value True for each aligned geometry that intersects other. |
invalid_coverage_edges | Return edges causing invalid polygonal coverage for each geometry. |
is_valid_coverage | Return whether the geometry column forms a valid polygonal coverage. |
is_valid_reason | Returns a Series of strings with the reason for invalidity of each geometry. |
line_merge | Return merged LineStrings. |
make_valid | Repairs invalid geometries. |
maximum_inscribed_circle | Return radius lines for the largest circles within polygonal geometries. |
minimum_bounding_circle | Return a GeoSeries of geometries representing the minimum bounding circle that encloses each geometry. |
minimum_bounding_radius | Return a Series of the radii of the minimum bounding circles that enclose each geometry. |
minimum_clearance | Return a Series containing the minimum clearance distance, which is the smallest distance by which a vertex of the geometry could be moved to produce an invalid geometry. |
minimum_clearance_line | Return linestrings whose endpoints define the minimum clearance. |
minimum_rotated_rectangle | Return the minimum rotated rectangle (oriented envelope) that encloses each geometry. |
normalize | Return a GeoSeries of normalized geometries. |
offset_curve | Returns a line at a given offset distance from each linear geometry. |
orient_polygons | Return geometries with a consistent polygon ring orientation. |
overlaps | Returns True for all aligned geometries that overlap other, else False. |
overlay | Perform a distributed spatial overlay with another GeoDataFrame. |
plot | Plot a GeoDataFrame. |
polygonize | Create polygons formed from the linework of a GeoSeries. |
project | Return the distance along each geometry nearest to other. |
relate | Returns the DE-9IM matrix string for the relationship between each geometry and other. |
relate_pattern | Returns a Series of dtype(‘bool’) with value True if the DE-9IM relationship between each geometry and other matches the specified pattern. |
remove_repeated_points | Return a GeoSeries with duplicate points removed. |
rename_geometry | Renames the GeoDataFrame geometry column to the specified name. |
representative_point | Return a point that is guaranteed to be within each geometry. |
reverse | Return a GeoSeries with the coordinate order reversed. |
rotate | Return a GeoSeries with rotated geometries. |
sample_points | Sample points from each geometry. |
scale | Return a GeoSeries with scaled geometries. |
segmentize | Returns a GeoSeries with vertices added to line segments based on maximum segment length. |
set_crs | Set the Coordinate Reference System (CRS) of the GeoDataFrame. |
set_geometry | Set the GeoDataFrame geometry using either an existing column or the specified input. |
shared_paths | Return the paths shared by each geometry and other. |
shortest_line | Returns the shortest line between each geometry in the GeoSeries and other. |
simplify | Returns a GeoSeries containing a simplified representation of each geometry. |
simplify_coverage | Simplify an edge-matched polygonal coverage using distributed joins. |
sjoin | Spatial join of two GeoDataFrames. |
sjoin_nearest | Join points to their nearest neighbors using Sedona KNN semantics. |
skew | Return a GeoSeries with skewed geometries. |
snap | Snap the vertices and segments of the geometry to vertices of the reference. |
symmetric_difference | Return a GeoSeries of the symmetric difference of points in each aligned geometry with other. |
to_arrow | Encode a GeoDataFrame to GeoArrow format. |
to_crs | Transform geometries to a new coordinate reference system. |
to_file | Write the GeoDataFrame to a file. |
to_geopandas | Note: Unlike in pandas and geopandas, Sedona will always return a general Index. |
to_json | Returns a GeoJSON representation of the GeoDataFrame as a string. |
to_parquet | Write the GeoDataFrame to a GeoParquet file. |
to_spark_pandas | Convert the GeoDataFrame to a Spark Pandas DataFrame. |
to_wkb | Encode all geometry columns in the GeoDataFrame to WKB. |
to_wkt | Encode all geometry columns in the GeoDataFrame to WKT. |
touches | Returns a Series of dtype(‘bool’) with value True for each aligned geometry that touches other. |
transform | Apply a function to geometry coordinates in distributed batches. |
translate | Return a GeoSeries with translated geometries. |
union | Return a GeoSeries of the union of points in each aligned geometry with other. |
union_all | Returns a geometry containing the union of all geometries in the GeoSeries. |
voronoi_polygons | Return Voronoi diagram of the vertices of each geometry. |
within | Returns a Series of dtype(‘bool’) with value True for each aligned geometry that is within other. |

