# GeoPandas — Geospatial Data Analysis in Python > An open-source Python library that extends pandas with geospatial data types and operations, making it easy to work with geographic data using familiar DataFrame workflows. ## Install Save as a script file and run: # GeoPandas — Geospatial Data Analysis in Python ## Quick Use ```bash pip install geopandas ``` ```python import geopandas as gpd world = gpd.read_file(gpd.datasets.get_path("naturalearth_lowres")) world.plot(column="pop_est", legend=True, figsize=(15, 10)) ``` ## Introduction GeoPandas is an open-source Python library that adds geographic data support to pandas. It combines the power of pandas DataFrames with the geometric operations of Shapely, the file I/O of Fiona, and the projections of pyproj, providing a single high-level interface for reading, analyzing, and visualizing geospatial data. ## What GeoPandas Does - Extends pandas DataFrames with a geometry column for spatial data (points, lines, polygons) - Reads and writes geospatial file formats including Shapefile, GeoJSON, GeoPackage, and GeoParquet - Performs spatial operations: intersections, unions, buffers, dissolves, and spatial joins - Handles coordinate reference system (CRS) transformations via pyproj - Creates static map visualizations with matplotlib integration ## Architecture Overview GeoPandas builds on top of pandas by subclassing DataFrame into GeoDataFrame and Series into GeoSeries. The geometry column stores Shapely geometry objects. Spatial operations delegate to Shapely for geometric computation, Fiona (or pyogrio) for file I/O, and pyproj for CRS handling. Recent versions use the GeoArrow specification for efficient in-memory representation, and pygeos or Shapely 2.0 for vectorized spatial operations. ## Self-Hosting & Configuration - Install via `pip install geopandas` or `conda install -c conda-forge geopandas` - For faster I/O, install pyogrio: `pip install pyogrio` and set the engine with `gpd.options.io_engine = "pyogrio"` - Read spatial data with `gpd.read_file()` supporting local files and URLs - Set or transform CRS with `gdf.set_crs()` and `gdf.to_crs()` - Export results via `gdf.to_file()`, `gdf.to_parquet()`, or `gdf.to_json()` ## Key Features - Familiar pandas API extended with spatial data types and operations - Broad file format support including GeoParquet for high-performance columnar storage - Built-in spatial joins and overlay operations for combining datasets - CRS-aware operations that handle projection transformations automatically - Integration with matplotlib, Folium, and other visualization libraries ## Comparison with Similar Tools - **Shapely** — Low-level geometry library; GeoPandas builds DataFrames on top of Shapely - **Fiona** — File I/O only; GeoPandas adds analysis, joins, and visualization - **PostGIS** — Server-side spatial database; GeoPandas runs in-process on DataFrames - **QGIS** — Full desktop GIS application; GeoPandas is a Python library for scripted analysis - **PySpark + Sedona** — Distributed spatial processing; GeoPandas targets single-machine workflows ## FAQ **Q: How does GeoPandas handle large datasets?** A: GeoPandas loads data into memory. For very large datasets, use GeoParquet for efficient I/O or consider Dask-GeoPandas for out-of-core processing. **Q: Can GeoPandas work with raster data?** A: No. GeoPandas handles vector data (points, lines, polygons). Use rasterio or xarray for raster data. **Q: What coordinate reference systems are supported?** A: GeoPandas supports any CRS that pyproj handles, including EPSG codes and WKT definitions. **Q: Is GeoPandas suitable for web applications?** A: GeoPandas is a data analysis library. For web maps, export GeoJSON and use Folium, Leaflet, or deck.gl. ## Sources - https://github.com/geopandas/geopandas - https://geopandas.org/ --- Source: https://tokrepo.com/en/workflows/asset-31bebd71 Author: Script Depot