
Geopandas
Teach your coding agent correct GeoPandas CRS handling—set_crs versus to_crs, formats, and common EPSG choices—for maps and spatial analytics pipelines.
Overview
Geopandas is an agent skill for the Build phase that documents GeoPandas coordinate reference system patterns—set_crs, to_crs, and common EPSG usage—for correct geospatial Python work.
Install
npx skills add https://github.com/k-dense-ai/scientific-agent-skills --skill geopandasWhat is this skill?
- Explains when to use set_crs() (metadata only) versus to_crs() (coordinate transform)
- Documents CRS input formats: EPSG integers, authority strings, WKT, PROJ strings, pyproj.CRS objects
- Shows alignment patterns such as reprojecting one GeoDataFrame to another’s crs
- Best practice callout: prefer WKT2 or EPSG authority strings to preserve full CRS definition
- Covers inspecting gdf.crs and detecting unset CRS before analysis
- Documents both integer EPSG (e.g. 4326) and authority string forms (e.g. EPSG:4326)
- Explicit warning: set_crs does not transform coordinates
Adoption & trust: 531 installs on skills.sh; 27.6k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your GeoDataFrames plot or measure wrong areas because CRS metadata is missing or you reprojected when you only needed to declare EPSG.
Who is it for?
Solo builders writing Python geospatial backends, research pipelines, or map analytics where agent-generated GeoPandas code must not confuse set_crs with to_crs.
Skip if: Teams needing turnkey GIS desktop workflows, pure JavaScript map-UI styling, or domains with no vector geometry in Python.
When should I use this skill?
Agent is writing or debugging GeoPandas code involving CRS assignment, inspection, or reprojection.
What do I get? / Deliverables
Your agent applies the right CRS API (set vs reproject), uses stable EPSG or WKT2 strings, and aligns frames before spatial operations.
- Correctly labeled or reprojected GeoDataFrame code patterns
- CRS checks before spatial joins or area statistics
Recommended Skills
Journey fit
Geospatial dataframe work is product and pipeline engineering during Build when backend code consumes or transforms location data. Backend fits because CRS metadata, reprojection, and GeoDataFrame operations are server-side or batch data logic—not frontend map tiles alone.
How it compares
Reference skill for CRS correctness in code—not a substitute for hosted tile servers or PostGIS schema design docs.
Common Questions / FAQ
Who is geopandas for?
Indie developers and researchers who ship Python spatial analytics and want agents to follow GeoPandas CRS conventions instead of guessing projections.
When should I use geopandas?
Use it in Build/backend while implementing ETL, joins, or choropleth pipelines; also in Idea/research when exploring whether EPSG:4326 vs projected CRS fits your dataset.
Is geopandas safe to install?
It is documentation-only procedural knowledge with no bundled executables—still review the Security Audits panel on this Prism page before enabling broader agent permissions on your repo.
SKILL.md
READMESKILL.md - Geopandas
# Coordinate Reference Systems (CRS) A coordinate reference system defines how coordinates relate to locations on Earth. ## Understanding CRS CRS information is stored as `pyproj.CRS` objects: ```python # Check CRS print(gdf.crs) # Check if CRS is set if gdf.crs is None: print("No CRS defined") ``` ## Setting vs Reprojecting ### Setting CRS Use `set_crs()` when coordinates are correct but CRS metadata is missing: ```python # Set CRS (doesn't transform coordinates) gdf = gdf.set_crs("EPSG:4326") gdf = gdf.set_crs(4326) ``` **Warning**: Only use when CRS metadata is missing. This does not transform coordinates. ### Reprojecting Use `to_crs()` to transform coordinates between coordinate systems: ```python # Reproject to different CRS gdf_projected = gdf.to_crs("EPSG:3857") # Web Mercator gdf_projected = gdf.to_crs(3857) # Reproject to match another GeoDataFrame gdf1_reprojected = gdf1.to_crs(gdf2.crs) ``` ## CRS Formats GeoPandas accepts multiple formats via `pyproj.CRS.from_user_input()`: ```python # EPSG code (integer) gdf.to_crs(4326) # Authority string gdf.to_crs("EPSG:4326") gdf.to_crs("ESRI:102003") # WKT string (Well-Known Text) gdf.to_crs("GEOGCS[...]") # PROJ string gdf.to_crs("+proj=longlat +datum=WGS84") # pyproj.CRS object from pyproj import CRS crs_obj = CRS.from_epsg(4326) gdf.to_crs(crs_obj) ``` **Best Practice**: Use WKT2 or authority strings (EPSG) to preserve full CRS information. ## Common EPSG Codes ### Geographic Coordinate Systems ```python # WGS 84 (latitude/longitude) gdf.to_crs("EPSG:4326") # NAD83 gdf.to_crs("EPSG:4269") ``` ### Projected Coordinate Systems ```python # Web Mercator (used by web maps) gdf.to_crs("EPSG:3857") # UTM zones (example: UTM Zone 33N) gdf.to_crs("EPSG:32633") # UTM zones (Southern hemisphere, example: UTM Zone 33S) gdf.to_crs("EPSG:32733") # US National Atlas Equal Area gdf.to_crs("ESRI:102003") # Albers Equal Area Conic (North America) gdf.to_crs("EPSG:5070") ``` ## CRS Requirements for Operations ### Operations Requiring Matching CRS These operations require identical CRS: ```python # Spatial joins gpd.sjoin(gdf1, gdf2, ...) # CRS must match # Overlay operations gpd.overlay(gdf1, gdf2, ...) # CRS must match # Appending pd.concat([gdf1, gdf2]) # CRS must match # Reproject first if needed gdf2_reprojected = gdf2.to_crs(gdf1.crs) result = gpd.sjoin(gdf1, gdf2_reprojected) ``` ### Operations Best in Projected CRS Area and distance calculations should use projected CRS: ```python # Bad: area in degrees (meaningless) areas_degrees = gdf.geometry.area # If CRS is EPSG:4326 # Good: reproject to appropriate projected CRS first gdf_projected = gdf.to_crs("EPSG:3857") areas_meters = gdf_projected.geometry.area # Square meters # Better: use appropriate local UTM zone for accuracy gdf_utm = gdf.to_crs("EPSG:32633") # UTM Zone 33N accurate_areas = gdf_utm.geometry.area ``` ## Choosing Appropriate CRS ### For Area/Distance Calculations Use equal-area projections: ```python # Albers Equal Area Conic (North America) gdf.to_crs("EPSG:5070") # Lambert Azimuthal Equal Area gdf.to_crs("EPSG:3035") # Europe # UTM zones (for local areas) gdf.to_crs("EPSG:32633") # Appropriate UTM zone ``` ### For Distance-Preserving (Navigation) Use equidistant projections: ```python # Azimuthal Equidistant gdf.to_crs("ESRI:54032") ``` ### For Shape-Preserving (Angles) Use conformal projections: ```python # Web Mercator (conformal but distorts area) gdf.to_crs("EPSG:3857") # UTM zones (conformal for local areas) gdf.to_crs("EPSG:32633") ``` ### For Web Mapping ```python # Web Mercator (standard for web maps) gdf.to_crs("EPSG:3857") ``` ## Estimating UTM Zone ```python # Estimate appropriate UTM CRS from data utm_crs = gdf.estimate_utm_crs() gdf_utm = gdf.to_crs(utm_crs) ``` ## Multiple Geometry Columns with Different CRS GeoPandas 0.8+ supports different CRS per geometry column: ```python # Set CRS for specific geometry column gdf = gdf.set_