GeoPandas
Use GeoPandas for planar vector data represented as pandas-like GeoSeries and
GeoDataFrame objects. This skill targets stable GeoPandas 1.1.4 (released
2026-06-26), not the unreleased 1.2 documentation.
Reproducible environment
GeoPandas 1.1.4 requires Python 3.10+; its tagged source requires NumPy >=1.24,
pandas >=2.0, Shapely >=2.0, pyproj >=3.5, pyogrio >=0.7.2, and packaging.
This exact Python 3.12 snapshot was smoke-tested on 2026-07-23:
uv venv --python 3.12
uv pip install \
"geopandas==1.1.4" \
"numpy==2.5.1" \
"pandas==3.0.5" \
"shapely==2.1.2" \
"pyproj==3.7.2" \
"pyogrio==0.13.0" \
"pyarrow==25.0.0" \
"packaging==26.2"
Keep optional plotting and PostGIS packages pinned in the project lock as well.
Do not mix binary geospatial packages from incompatible package channels.
Safety and privacy contract
- Treat exact coordinates, addresses, parcel boundaries, trajectories, and
small-area joins as sensitive. Default reports to counts, categories, coarse
extents, and redacted identifiers. Generalize before publication.
- Never automatically load a URL, cloud URI, GDAL
/vsi* path, archive, or
geocode an address. Obtain explicit approval, validate provenance and hashes,
then stage an unpacked local file in an isolated workspace.
- GDAL/OGR drivers, GEOS, PROJ, pyogrio, Shapely, pyproj, and their wheels are a
native-code trust boundary. Prefer official wheels/conda-forge, record native
versions, restrict drivers, and process untrusted data in a sandbox.
- Do not open macro-enabled office files or nested archives through permissive
GDAL drivers. The bundled CLIs use an extension allowlist and reject archives.
- Read only named database secrets such as
GEOPANDAS_POSTGIS_PASSWORD; use a
secret manager or scoped environment variable. Never embed a password in a
URL or source, print an engine/URL, or dump the environment.
- Every derived artifact needs source hashes/versions, CRS, operation parameters,
predicate, join cardinality, precision/repair choices, and row-count checks.
Correctness gates
Apply these gates before trusting a result:
- Identity and provenance — identify the source layer, stable feature key,
duplicate IDs, row count, geometry column, parser/driver, and content hash.
- Geometry state — count null, empty, invalid, mixed, Z/M, and collapsed
geometries separately.
None is missing; an empty Shapely geometry is real.
- CRS semantics — require CRS metadata.
set_crs() assigns metadata;
to_crs() transforms coordinates. Never guess a CRS from coordinate ranges.
- Units and operation — GeoPandas is planar. Geographic coordinates are
angular; do not use them directly for buffer, distance, area, nearest joins,
precision grids, or tolerances. Choose a fit-for-purpose local/equal-area CRS
or a geodesic method.
- Transform quality — inspect axis order, area of use, datum pipeline,
expected accuracy, ballpark status, and missing grids. Keep PROJ network
disabled unless the user explicitly approves grid retrieval.
- Topology and precision — validate before and after repair/overlay. Pick a
precision grid from source accuracy and CRS units; arbitrary snapping can
collapse features or create bias.
- Cardinality — state expected one-to-one, one-to-many, or many-to-many
behavior before
merge, sjoin, or sjoin_nearest; audit unmatched and
multiplied rows afterward.
- Output contract — use a new output path, preserve a stable feature ID,
document schema/CRS/encoding, reopen the artifact, and compare counts/types.
CRS and antimeridian rules
GeoPandas stores CRS as pyproj.CRS. Coordinate arrays use traditional GIS
(x, y) order, while authority definitions can advertise latitude-first axes.
Use Transformer(..., always_xy=True) for explicit coordinate-array pipelines,
and record that choice.
to_crs() transforms vertices and assumes each segment is straight in the
source CRS; it does not transform geodesic arcs. Geometries crossing ±180° or a
projection boundary can be badly wrapped. Detect crossings, split/unwrap and
densify in a documented geographic representation, transform parts, then
validate. Do not use Web Mercator as a general measurement CRS.
crs = gdf.crs # a pyproj.CRS when present
if crs is None or crs.is_geographic:
raise ValueError("Choose a justified projected CRS before planar measurement")
unit_names = [axis.unit_name for axis in crs.axis_info]
areas = gdf.geometry.area # square CRS units, not automatically square metres
See CRS management.
Core API decisions
Data structures
- A
GeoDataFrame can hold multiple geometry columns, each with CRS metadata,
but only active_geometry_name drives frame-level spatial operations.
- Binary
GeoSeries methods are row-wise and align by index by default. Use
align=False only when positional pairing is explicitly intended and lengths
and order were verified.
- Duplicate column names and duplicate feature IDs are ambiguous; reject or
resolve them before joins and exports.
See data structures.
Geometry validity, precision, and union
Use is_valid and redacted is_valid_reason() categories before
make_valid(method="linework"|"structure", keep_collapsed=...). Repair can
change geometry type or dimension; retain the original and compare counts,
area, types, empties, and collapsed parts.
set_precision(grid_size, mode=...) uses CRS units and may remove duplicate
vertices or collapse features. union_all(method="unary", grid_size=...) is the
robust default. Use coverage only after is_valid_coverage() proves
non-overlap and edge matching; use disjoint_subset with Shapely >=2.1 when its
partitioning assumption is useful.
See geometric operations.
Joins, overlay, clip, and dissolve
sjoin predicates are directional: left.within(right) is not
left.contains(right). intersects includes boundary contact; contains
excludes boundary-only points, while covers includes boundary points.
predicate="dwithin" requires distance; scalar or per-left-row distances
are in CRS units. sjoin_nearest returns all equidistant nearest matches and
does not implement a k= parameter.
overlay(..., make_valid=True) repairs invalid input but can change types;
keep_geom_type=None drops other types with a warning. Precision mismatch can
create slivers; quantify them rather than silently deleting them.
clip dissolves the mask. Rectangle clipping is fast but possibly dirty and
may omit a line collapsed to a point; validate its output.
dissolve combines groupby.agg with union_all; choose explicit attribute
aggregations and audit null group keys.
See spatial analysis.
I/O, Arrow, and PostGIS
GeoPandas 1.x defaults to pyogrio. Driver availability and semantics come from
the installed GDAL, not GeoPandas alone. Prefer local GeoPackage for general
interchange and WKB GeoParquet for columnar interoperability.
GeoParquet defaults to stable schema 1.0.0. Native GeoArrow encodings and bbox
covering require schema 1.1.0 and remain less interoperable. A missing GeoParquet
crs key means OGC:CRS84; explicit crs: null means unknown—do not conflate
them. Reopen and validate every export.
Use parameterized SQL and a SQLAlchemy Engine/Connection for PostGIS.
if_exists="replace" is destructive; default to "fail" and use a transaction.
See data I/O.
Migration checklist
For code moving from GeoPandas 0.14 or earlier:
- GeoPandas 1.0 supports Shapely >=2 only; PyGEOS, Shapely <2, and the rtree
spatial-index backend were removed.
- pyogrio replaced Fiona as the installed/default I/O engine. Set
engine=
explicitly and test schema, empty, datetime, encoding, and append behavior.
- Replace
sjoin(op=...) with predicate=, sindex.query_bulk() with
sindex.query(), unary_union with union_all(), and
GeometryArray.data with to_numpy()/np.asarray.
- Replace
read_file(include_fields=...|ignore_fields=...) with columns=.
Use schema_version=, not the removed GeoParquet version= compatibility.
- Do not use removed
geopandas.datasets, internal geopandas.io.* entry
points, plot axes/colormap, or set-operation operators.
explode() now defaults index_parts=False; a named Series passed to
set_geometry() supplies the new active-column name; a named right index can
replace index_right in sjoin output.
- Do not assign
.crs to override metadata or rely on deprecated
set_geometry(drop=...); use explicit set_crs() and rename/drop steps.
- GeoPandas 1.1 requires Python >=3.10, pandas >=2.0, NumPy >=1.24, and pyproj
=3.5. Version 1.1.2 fixed SQL injection through a PostGIS geometry-column
name; the pinned 1.1.4 includes that fix.
Plotting and exploration
Maps are analytical outputs: label units, classification method, missing data,
normalization denominator, and date. explore() can expose every attribute in
tooltips/popups and contact tile/CDN servers; generalize first and use
tiles=None, tooltip=False, and popup=False for a local draft.
See visualization.
Bundled local CLIs
All helpers are deterministic, reject network/archive paths, bound input bytes
and feature counts, keep imports lazy so --help is dependency-free, and emit
JSON without coordinates or record identifiers.
| CLI |
Purpose |
scripts/vector_inventory.py |
Redacted local vector/GeoParquet technical inventory |
scripts/crs_reprojection_plan.py |
CRS units, axes, candidate transform and antimeridian plan |
scripts/geometry_validity_report.py |
Dry-run validity audit; optional repair to a new GeoPackage |
scripts/spatial_join_audit.py |
Predicate semantics, duplicate IDs and join cardinality |
scripts/export_plan.py |
Non-executing vector/GeoParquet export contract |
scripts/sensitive_coordinates_checklist.py |
Privacy/generalization release gate |
python skills/geopandas/scripts/vector_inventory.py --help
python skills/geopandas/scripts/crs_reprojection_plan.py \
--source-crs EPSG:4326 --target-crs EPSG:32631
python skills/geopandas/scripts/geometry_validity_report.py data.gpkg
python skills/geopandas/scripts/spatial_join_audit.py points.gpkg zones.gpkg \
--predicate within --left-id point_id --right-id zone_id
python skills/geopandas/scripts/export_plan.py data.gpkg result.parquet \
--format geoparquet --schema-version 1.0.0 \
--stable-id-column feature_id --id-unique-verified
python skills/geopandas/scripts/sensitive_coordinates_checklist.py \
--public-output --precise-points --contains-addresses
Reference index
- Data structures
- CRS management
- Geometric operations
- Spatial analysis
- Data I/O
- Visualization
Sources (verified 2026-07-23)
1---
2name: geopandas
3description: Guidance and local audit tools for Python workflows that directly use GeoPandas GeoSeries, GeoDataFrame, spatial operations, or vector-data I/O.
4license: MIT
5compatibility: Requires Python 3.10+ and uv. Bundled CLIs are local-only; runtime analysis requires the pinned GeoPandas stack below.
6allowed-tools: Read Write Bash Glob Grep
7metadata:
8 version: "1.1"
9 skill-author: K-Dense Inc.
10 last-reviewed: "2026-07-23"
11---
12
13# GeoPandas
14
15Use GeoPandas for planar vector data represented as pandas-like `GeoSeries` and
16`GeoDataFrame` objects. This skill targets stable **GeoPandas 1.1.4** (released
172026-06-26), not the unreleased 1.2 documentation.
18
19## Reproducible environment
20
21GeoPandas 1.1.4 requires Python 3.10+; its tagged source requires NumPy >=1.24,
22pandas >=2.0, Shapely >=2.0, pyproj >=3.5, pyogrio >=0.7.2, and `packaging`.
23This exact Python 3.12 snapshot was smoke-tested on 2026-07-23:
24
25```bash
26uv venv --python 3.12
27uv pip install \
28 "geopandas==1.1.4" \
29 "numpy==2.5.1" \
30 "pandas==3.0.5" \
31 "shapely==2.1.2" \
32 "pyproj==3.7.2" \
33 "pyogrio==0.13.0" \
34 "pyarrow==25.0.0" \
35 "packaging==26.2"
36```
37
38Keep optional plotting and PostGIS packages pinned in the project lock as well.
39Do not mix binary geospatial packages from incompatible package channels.
40
41## Safety and privacy contract
42
43- Treat exact coordinates, addresses, parcel boundaries, trajectories, and
44 small-area joins as sensitive. Default reports to counts, categories, coarse
45 extents, and redacted identifiers. Generalize before publication.
46- Never automatically load a URL, cloud URI, GDAL `/vsi*` path, archive, or
47 geocode an address. Obtain explicit approval, validate provenance and hashes,
48 then stage an unpacked local file in an isolated workspace.
49- GDAL/OGR drivers, GEOS, PROJ, pyogrio, Shapely, pyproj, and their wheels are a
50 native-code trust boundary. Prefer official wheels/conda-forge, record native
51 versions, restrict drivers, and process untrusted data in a sandbox.
52- Do not open macro-enabled office files or nested archives through permissive
53 GDAL drivers. The bundled CLIs use an extension allowlist and reject archives.
54- Read only named database secrets such as `GEOPANDAS_POSTGIS_PASSWORD`; use a
55 secret manager or scoped environment variable. Never embed a password in a
56 URL or source, print an engine/URL, or dump the environment.
57- Every derived artifact needs source hashes/versions, CRS, operation parameters,
58 predicate, join cardinality, precision/repair choices, and row-count checks.
59
60## Correctness gates
61
62Apply these gates before trusting a result:
63
641. **Identity and provenance** — identify the source layer, stable feature key,
65 duplicate IDs, row count, geometry column, parser/driver, and content hash.
662. **Geometry state** — count null, empty, invalid, mixed, Z/M, and collapsed
67 geometries separately. `None` is missing; an empty Shapely geometry is real.
683. **CRS semantics** — require CRS metadata. `set_crs()` assigns metadata;
69 `to_crs()` transforms coordinates. Never guess a CRS from coordinate ranges.
704. **Units and operation** — GeoPandas is planar. Geographic coordinates are
71 angular; do not use them directly for buffer, distance, area, nearest joins,
72 precision grids, or tolerances. Choose a fit-for-purpose local/equal-area CRS
73 or a geodesic method.
745. **Transform quality** — inspect axis order, area of use, datum pipeline,
75 expected accuracy, ballpark status, and missing grids. Keep PROJ network
76 disabled unless the user explicitly approves grid retrieval.
776. **Topology and precision** — validate before and after repair/overlay. Pick a
78 precision grid from source accuracy and CRS units; arbitrary snapping can
79 collapse features or create bias.
807. **Cardinality** — state expected one-to-one, one-to-many, or many-to-many
81 behavior before `merge`, `sjoin`, or `sjoin_nearest`; audit unmatched and
82 multiplied rows afterward.
838. **Output contract** — use a new output path, preserve a stable feature ID,
84 document schema/CRS/encoding, reopen the artifact, and compare counts/types.
85
86## CRS and antimeridian rules
87
88GeoPandas stores CRS as `pyproj.CRS`. Coordinate arrays use traditional GIS
89`(x, y)` order, while authority definitions can advertise latitude-first axes.
90Use `Transformer(..., always_xy=True)` for explicit coordinate-array pipelines,
91and record that choice.
92
93`to_crs()` transforms vertices and assumes each segment is straight in the
94source CRS; it does not transform geodesic arcs. Geometries crossing ±180° or a
95projection boundary can be badly wrapped. Detect crossings, split/unwrap and
96densify in a documented geographic representation, transform parts, then
97validate. Do not use Web Mercator as a general measurement CRS.
98
99```python
100crs = gdf.crs # a pyproj.CRS when present
101if crs is None or crs.is_geographic:
102 raise ValueError("Choose a justified projected CRS before planar measurement")
103
104unit_names = [axis.unit_name for axis in crs.axis_info]
105areas = gdf.geometry.area # square CRS units, not automatically square metres
106```
107
108See [CRS management](references/crs-management.md).
109
110## Core API decisions
111
112### Data structures
113
114- A `GeoDataFrame` can hold multiple geometry columns, each with CRS metadata,
115 but only `active_geometry_name` drives frame-level spatial operations.
116- Binary `GeoSeries` methods are row-wise and align by index by default. Use
117 `align=False` only when positional pairing is explicitly intended and lengths
118 and order were verified.
119- Duplicate column names and duplicate feature IDs are ambiguous; reject or
120 resolve them before joins and exports.
121
122See [data structures](references/data-structures.md).
123
124### Geometry validity, precision, and union
125
126Use `is_valid` and redacted `is_valid_reason()` categories before
127`make_valid(method="linework"|"structure", keep_collapsed=...)`. Repair can
128change geometry type or dimension; retain the original and compare counts,
129area, types, empties, and collapsed parts.
130
131`set_precision(grid_size, mode=...)` uses **CRS units** and may remove duplicate
132vertices or collapse features. `union_all(method="unary", grid_size=...)` is the
133robust default. Use `coverage` only after `is_valid_coverage()` proves
134non-overlap and edge matching; use `disjoint_subset` with Shapely >=2.1 when its
135partitioning assumption is useful.
136
137See [geometric operations](references/geometric-operations.md).
138
139### Joins, overlay, clip, and dissolve
140
141- `sjoin` predicates are directional: `left.within(right)` is not
142 `left.contains(right)`. `intersects` includes boundary contact; `contains`
143 excludes boundary-only points, while `covers` includes boundary points.
144- `predicate="dwithin"` requires `distance`; scalar or per-left-row distances
145 are in CRS units. `sjoin_nearest` returns all equidistant nearest matches and
146 does **not** implement a `k=` parameter.
147- `overlay(..., make_valid=True)` repairs invalid input but can change types;
148 `keep_geom_type=None` drops other types with a warning. Precision mismatch can
149 create slivers; quantify them rather than silently deleting them.
150- `clip` dissolves the mask. Rectangle clipping is fast but possibly dirty and
151 may omit a line collapsed to a point; validate its output.
152- `dissolve` combines `groupby.agg` with `union_all`; choose explicit attribute
153 aggregations and audit null group keys.
154
155See [spatial analysis](references/spatial-analysis.md).
156
157### I/O, Arrow, and PostGIS
158
159GeoPandas 1.x defaults to pyogrio. Driver availability and semantics come from
160the installed GDAL, not GeoPandas alone. Prefer local GeoPackage for general
161interchange and WKB GeoParquet for columnar interoperability.
162
163GeoParquet defaults to stable schema 1.0.0. Native GeoArrow encodings and bbox
164covering require schema 1.1.0 and remain less interoperable. A missing GeoParquet
165`crs` key means `OGC:CRS84`; explicit `crs: null` means unknown—do not conflate
166them. Reopen and validate every export.
167
168Use parameterized SQL and a SQLAlchemy `Engine`/`Connection` for PostGIS.
169`if_exists="replace"` is destructive; default to `"fail"` and use a transaction.
170
171See [data I/O](references/data-io.md).
172
173## Migration checklist
174
175For code moving from GeoPandas 0.14 or earlier:
176
177- GeoPandas 1.0 supports Shapely >=2 only; PyGEOS, Shapely <2, and the rtree
178 spatial-index backend were removed.
179- pyogrio replaced Fiona as the installed/default I/O engine. Set `engine=`
180 explicitly and test schema, empty, datetime, encoding, and append behavior.
181- Replace `sjoin(op=...)` with `predicate=`, `sindex.query_bulk()` with
182 `sindex.query()`, `unary_union` with `union_all()`, and
183 `GeometryArray.data` with `to_numpy()`/`np.asarray`.
184- Replace `read_file(include_fields=...|ignore_fields=...)` with `columns=`.
185 Use `schema_version=`, not the removed GeoParquet `version=` compatibility.
186- Do not use removed `geopandas.datasets`, internal `geopandas.io.*` entry
187 points, plot `axes`/`colormap`, or set-operation operators.
188- `explode()` now defaults `index_parts=False`; a named Series passed to
189 `set_geometry()` supplies the new active-column name; a named right index can
190 replace `index_right` in `sjoin` output.
191- Do not assign `.crs` to override metadata or rely on deprecated
192 `set_geometry(drop=...)`; use explicit `set_crs()` and rename/drop steps.
193- GeoPandas 1.1 requires Python >=3.10, pandas >=2.0, NumPy >=1.24, and pyproj
194 >=3.5. Version 1.1.2 fixed SQL injection through a PostGIS geometry-column
195 name; the pinned 1.1.4 includes that fix.
196
197### Plotting and exploration
198
199Maps are analytical outputs: label units, classification method, missing data,
200normalization denominator, and date. `explore()` can expose every attribute in
201tooltips/popups and contact tile/CDN servers; generalize first and use
202`tiles=None`, `tooltip=False`, and `popup=False` for a local draft.
203
204See [visualization](references/visualization.md).
205
206## Bundled local CLIs
207
208All helpers are deterministic, reject network/archive paths, bound input bytes
209and feature counts, keep imports lazy so `--help` is dependency-free, and emit
210JSON without coordinates or record identifiers.
211
212| CLI | Purpose |
213|---|---|
214| `scripts/vector_inventory.py` | Redacted local vector/GeoParquet technical inventory |
215| `scripts/crs_reprojection_plan.py` | CRS units, axes, candidate transform and antimeridian plan |
216| `scripts/geometry_validity_report.py` | Dry-run validity audit; optional repair to a new GeoPackage |
217| `scripts/spatial_join_audit.py` | Predicate semantics, duplicate IDs and join cardinality |
218| `scripts/export_plan.py` | Non-executing vector/GeoParquet export contract |
219| `scripts/sensitive_coordinates_checklist.py` | Privacy/generalization release gate |
220
221```bash
222python skills/geopandas/scripts/vector_inventory.py --help
223python skills/geopandas/scripts/crs_reprojection_plan.py \
224 --source-crs EPSG:4326 --target-crs EPSG:32631
225python skills/geopandas/scripts/geometry_validity_report.py data.gpkg
226python skills/geopandas/scripts/spatial_join_audit.py points.gpkg zones.gpkg \
227 --predicate within --left-id point_id --right-id zone_id
228python skills/geopandas/scripts/export_plan.py data.gpkg result.parquet \
229 --format geoparquet --schema-version 1.0.0 \
230 --stable-id-column feature_id --id-unique-verified
231python skills/geopandas/scripts/sensitive_coordinates_checklist.py \
232 --public-output --precise-points --contains-addresses
233```
234
235## Reference index
236
237- [Data structures](references/data-structures.md)
238- [CRS management](references/crs-management.md)
239- [Geometric operations](references/geometric-operations.md)
240- [Spatial analysis](references/spatial-analysis.md)
241- [Data I/O](references/data-io.md)
242- [Visualization](references/visualization.md)
243
244## Sources (verified 2026-07-23)
245
246- [GeoPandas 1.1.4 on PyPI](https://pypi.org/project/geopandas/1.1.4/) — released 2026-06-26.
247- [GeoPandas 1.1.4 release](https://github.com/geopandas/geopandas/releases/tag/v1.1.4) — bug-fix release.
248- [GeoPandas 1.1.4 tagged dependencies](https://github.com/geopandas/geopandas/blob/v1.1.4/pyproject.toml).
249- [Stable GeoPandas documentation](https://geopandas.org/en/stable/).
250- [GeoPandas 1.0 migration release](https://github.com/geopandas/geopandas/releases/tag/v1.0.0).