geopandas

Analyze and visualize geospatial vector data with GeoPandas in Python.

Updated Oct 7, 2022
One-click install
npx skills add https://github.com/tamagusko/linux-cfg --skill geopandas-tamagusko
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: geopandas
Source: https://github.com/tamagusko/linux-cfg/tree/main/dotfiles/claude/skills/geopandas
Command: npx skills add https://github.com/tamagusko/linux-cfg --skill geopandas-tamagusko

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires geopandas, folium, mapclassify, pyarrow, psycopg2, geoalchemy2, contextily, cartopy, and includes references (resource) components.

What problem does it solve? Working with geographic vector data in Python requires coordinating file formats, coordinate reference systems, spatial joins, and mapping libraries. This Skill provides structured guidance for performing spatial analysis with GeoPandas without memorizing its API surface. ## Core Features & Use Cases - Spatial Data I/O: Read and write Shapefiles, GeoJSON, GeoPackage, Parquet, and PostGIS tables with filtering and Arrow acceleration. - Spatial Analysis: Perform spatial joins, nearest-neighbor joins, overlay operations, dissolves, clipping, and geometric operations like buffering and simplification. - CRS Management: Set, transform, and validate coordinate reference systems for accurate area and distance calculations. - Mapping: Create choropleth maps with classification schemes and interactive Folium maps. - Use Case: Join a dataset of store locations to census tract polygons, calculate coverage areas in a projected CRS, and export an interactive HTML map for stakeholders. ## Quick Start Use the geopandas skill to load my shapefile, reproject it to EPSG:3857, and create a choropleth map colored by population.

Frequently Asked Questions about geopandas

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I perform a spatial join in GeoPandas?

Use gpd.sjoin(gdf1, gdf2, predicate='intersects') to join two GeoDataFrames based on spatial relationships like intersects, within, or contains. Both GeoDataFrames must share the same CRS, so reproject with to_crs() first if needed.

How do I read a shapefile or GeoJSON file in Python?

Use geopandas.read_file() with the file path, URL, or even a ZIP archive. You can filter during reading with bbox, mask, rows, or where parameters, and pass use_arrow=True with pyarrow installed for 2-4x faster I/O.

What is the difference between set_crs and to_crs in GeoPandas?

set_crs() only assigns CRS metadata without changing coordinates, and should be used only when CRS information is missing. to_crs() actually transforms coordinates to a different coordinate reference system, such as reprojecting from EPSG:4326 to EPSG:3857.

Can GeoPandas connect to a PostGIS database?

Yes, use gpd.read_postgis() with a SQLAlchemy engine to run SQL queries against PostGIS, and gdf.to_postgis() to write results back with replace, append, or fail modes. This requires psycopg2 and geoalchemy2 installed.

Why are my area calculations wrong in GeoPandas?

Area and distance calculations in a geographic CRS like EPSG:4326 return values in degrees, which are meaningless. Reproject to a projected CRS such as a UTM zone or EPSG:3857 using to_crs() before calling .area or .length.

How do I create an interactive map from a GeoDataFrame?

Call gdf.explore() with folium installed to generate an interactive Leaflet map, optionally coloring by a column and adding tooltips. Save the result with m.save('map.html') for sharing in a browser.