or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

coordinate-systems.mdcore-data-structures.mdfile-io.mdgeometric-operations.mdindex.mdspatial-relationships.mdtesting-utilities.mdvisualization.md
tile.json

tessl/pypi-geopandas

GeoPandas extends pandas functionality to handle geographic and geospatial data operations with GeoSeries and GeoDataFrame classes.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/geopandas@1.1.x

To install, run

npx @tessl/cli install tessl/pypi-geopandas@1.1.0

index.mddocs/

GeoPandas

GeoPandas is a comprehensive Python library that extends pandas functionality to handle geographic and geospatial data operations. It provides GeoSeries and GeoDataFrame classes as subclasses of pandas Series and DataFrame, enabling users to work with shapely geometry objects and perform geometric operations directly within the familiar pandas data manipulation framework.

Package Information

  • Package Name: geopandas
  • Language: Python
  • Installation: pip install geopandas
  • Documentation: https://geopandas.org

Core Imports

import geopandas as gpd

Common imports for working with geometry data:

import geopandas as gpd
import pandas as pd
from shapely.geometry import Point, Polygon, LineString

Basic Usage

import geopandas as gpd
import pandas as pd
from shapely.geometry import Point

# Create a GeoDataFrame from points
geometry = [Point(xy) for xy in zip([-1, 0, 1], [1, 0, -1])]
df = pd.DataFrame({'City': ['City A', 'City B', 'City C']})
gdf = gpd.GeoDataFrame(df, geometry=geometry)

# Read geospatial data from file
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
cities = gpd.read_file(gpd.datasets.get_path('naturalearth_cities'))

# Basic geospatial operations
world_area = world.geometry.area
world_centroid = world.geometry.centroid
world_bounds = world.total_bounds

# Coordinate reference system transformations
world_utm = world.to_crs('EPSG:3857')  # Web Mercator projection

# Spatial joins
cities_in_countries = gpd.sjoin(cities, world, how='left', predicate='within')

# Create a simple plot
world.plot(figsize=(10, 6))

Architecture

GeoPandas extends the pandas ecosystem with geospatial capabilities:

  • GeoDataFrame: Main data structure extending pandas DataFrame with geometry column support and spatial operations
  • GeoSeries: Series-like structure for holding geometry objects with spatial methods and properties
  • GeometryArray: Extension array for efficient storage and manipulation of geometry data
  • CRS (Coordinate Reference System): Management of spatial reference systems and coordinate transformations
  • Spatial Index: Performance optimization for spatial queries using spatial indexing

This design provides seamless integration with pandas workflows while adding comprehensive geospatial functionality through shapely geometric objects, coordinate system management, and spatial file I/O capabilities.

Capabilities

Core Data Structures

GeoDataFrame and GeoSeries classes that extend pandas functionality with geometry column support, spatial properties, and coordinate reference system management.

class GeoDataFrame(DataFrame):
    def __init__(data=None, index=None, columns=None, dtype=None, copy=None, geometry=None, crs=None): ...
    
class GeoSeries(Series):
    def __init__(data=None, index=None, crs=None, **kwargs): ...

Core Data Structures

File I/O Operations

Reading and writing various geospatial file formats including Shapefile, GeoJSON, GeoPackage, Parquet, and database connections.

def read_file(filename, **kwargs): ...
def read_parquet(path, **kwargs): ...
def read_feather(path, **kwargs): ...
def read_postgis(sql, con, **kwargs): ...
def list_layers(filename): ...

File I/O Operations

Coordinate Reference Systems

CRS management and coordinate transformations enabling work with different spatial reference systems and projections.

def set_crs(crs, allow_override=False, inplace=False): ...
def to_crs(crs, **kwargs): ...
def estimate_utm_crs(datum_name='WGS 84'): ...

Coordinate Reference Systems

Geometric Operations

Spatial analysis and geometric computations including buffering, simplification, area calculations, and spatial predicates.

def buffer(distance, resolution=16, **kwargs): ...
def simplify(tolerance, preserve_topology=True): ...
def area(): ...
def length(): ...
def centroid(): ...
def boundary(): ...
def convex_hull(): ...
def envelope(): ...

Geometric Operations

Spatial Relationships

Spatial joins, overlays, and relationship testing between geometric objects including intersection, union, and containment operations.

def sjoin(left_df, right_df, how='inner', predicate='intersects', lsuffix='left', rsuffix='right', **kwargs): ...
def sjoin_nearest(left_df, right_df, how='inner', max_distance=None, lsuffix='left', rsuffix='right', **kwargs): ...
def overlay(df1, df2, how='intersection', keep_geom_type=None, make_valid=True): ...
def clip(gdf, mask, keep_geom_type=False, sort=False): ...

Spatial Relationships

Visualization

Static and interactive mapping capabilities for creating publication-quality maps and exploratory data visualizations.

def plot(ax=None, figsize=None, color=None, edgecolor=None, **kwargs): ...
def explore(color=None, marker_type='marker', tiles='OpenStreetMap', **kwargs): ...

Visualization

Testing Utilities

Assertion functions and version information utilities for testing geospatial data structures and debugging dependency issues.

def assert_geoseries_equal(left, right, **kwargs): ...
def assert_geodataframe_equal(left, right, **kwargs): ...
def show_versions(): ...

Testing Utilities