k-dense-ai/geopandas
Guidance and local audit tools for Python workflows that directly use GeoPandas GeoSeries, GeoDataFrame, spatial operations, or vector-data I/O.
npx skills add https://github.com/K-Dense-AI/scientific-agent-skills --skill 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.
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.
small-area joins as sensitive. Default reports to counts, categories, coarse
extents, and redacted identifiers. Generalize before publication.
/vsi* path, archive, orgeocode an address. Obtain explicit approval, validate provenance and hashes,
then stage an unpacked local file in an isolated workspace.
native-code trust boundary. Prefer official wheels/conda-forge, record native
versions, restrict drivers, and process untrusted data in a sandbox.
GDAL drivers. The bundled CLIs use an extension allowlist and reject archives.
GEOPANDAS_POSTGIS_PASSWORD; use asecret manager or scoped environment variable. Never embed a password in a
URL or source, print an engine/URL, or dump the environment.
predicate, join cardinality, precision/repair choices, and row-count checks.
Apply these gates before trusting a result:
duplicate IDs, row count, geometry column, parser/driver, and content hash.
geometries separately. None is missing; an empty Shapely geometry is real.
set_crs() assigns metadata;to_crs() transforms coordinates. Never guess a CRS from coordinate ranges.
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.
expected accuracy, ballpark status, and missing grids. Keep PROJ network
disabled unless the user explicitly approves grid retrieval.
precision grid from source accuracy and CRS units; arbitrary snapping can
collapse features or create bias.
behavior before merge, sjoin, or sjoin_nearest; audit unmatched and
multiplied rows afterward.
document schema/CRS/encoding, reopen the artifact, and compare counts/types.
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.
GeoDataFrame can hold multiple geometry columns, each with CRS metadata,but only active_geometry_name drives frame-level spatial operations.
GeoSeries methods are row-wise and align by index by default. Usealign=False only when positional pairing is explicitly intended and lengths
and order were verified.
resolve them before joins and exports.
See data structures.
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.
sjoin predicates are directional: left.within(right) is notleft.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 distancesare 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 andmay omit a line collapsed to a point; validate its output.
dissolve combines groupby.agg with union_all; choose explicit attributeaggregations and audit null group keys.
See spatial analysis.
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.
For code moving from GeoPandas 0.14 or earlier:
spatial-index backend were removed.
engine=explicitly and test schema, empty, datetime, encoding, and append behavior.
sjoin(op=...) with predicate=, sindex.query_bulk() withsindex.query(), unary_union with union_all(), and
GeometryArray.data with to_numpy()/np.asarray.
read_file(include_fields=...|ignore_fields=...) with columns=.Use schema_version=, not the removed GeoParquet version= compatibility.
geopandas.datasets, internal geopandas.io.* entrypoints, plot axes/colormap, or set-operation operators.
explode() now defaults index_parts=False; a named Series passed toset_geometry() supplies the new active-column name; a named right index can
replace index_right in sjoin output.
.crs to override metadata or rely on deprecatedset_geometry(drop=...); use explicit set_crs() and rename/drop steps.
>=3.5. Version 1.1.2 fixed SQL injection through a PostGIS geometry-column
name; the pinned 1.1.4 includes that fix.
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.
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
Take k-dense-ai/geopandas from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference pip, uv.
Without those the skill loads but fails at the first command.