Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Geopandas Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-geopandas-knowledge-patch-nevaberry-plugins)
---
name: geopandas-knowledge-patch
description: GeoPandas
version: "1.2.0"
license: MIT
metadata:
author: Nevaberry
---
# GeoPandas Knowledge Patch
Use this skill when updating GeoPandas code or working with geometry operations,
pandas integration, spatial I/O, sampling, and maps. Load the relevant topic
reference for dependency requirements, migration details, and behavior fixes.
## Reference index
| Reference | Topics |
| --- | --- |
| [Dependency Compatibility](references/compatibility.md) | Required and tested dependency minimums; removed geometry methods and backend option |
| [Geometry Operations](references/geometry-operations.md) | Alignment, repair, coverage validity, unions, precision, grids, M coordinates, spatial queries, clipping, sorting, CRS |
| [I/O and Databases](references/io-and-databases.md) | File reads, CSV, WKT/WKB, Arrow, Parquet, Feather, features, PostGIS |
| [Overlays, Sampling, and Maps](references/overlays-sampling-and-maps.md) | Overlay fixes, pointpats, sampling order, static plotting, legends, basemaps, explore |
| [pandas Integration](references/pandas-integration.md) | Geometry columns, constructors, accessors, aggregation, spatial-join index names, row assignment, explode |
## Breaking changes and deprecations
### Removed APIs and buffer keyword
- `GeoSeries.select` has been removed.
- Replace the removed `geom_almost_equals` with `geom_equals_exact`.
- `sample_points` has removed `seed`; pass the seed using `rng`.
- Remove assignments to `geopandas.options.use_pygeos`; the already inactive option
has been removed.
- The `resolution` keyword to `buffer` is deprecated. Use
`gdf.geometry.buffer(10, quad_segs=8)` to set segments per quarter circle.
### Geometry-column naming and replacement
Since 1.0, `set_geometry(ser)` uses `ser.name` when set and retains the old geometry
column if the names differ. To replace the existing active column, use:
```python
gdf.set_geometry(ser.rename(gdf.active_geometry_name))
```
The `GeoDataFrame(..., geometry=ser)` constructor still names the column
`"geometry"`.
### Migrating set_geometry drop calls
The `drop` argument to `set_geometry` is deprecated since 1.0. Omit explicit
`drop=False`. To reproduce `drop=True` when switching to a different existing
geometry column:
```python
old_name = gdf.active_geometry_name
gdf = gdf.set_geometry("alternate").drop(columns=old_name).rename_geometry(old_name)
```
### Explicit alignment and spatial-join column names
Since 1.0, binary geometry methods default to `align=None`, which aligns by index
and warns if the indices differ. Pass `align=True` to align without the warning:
`left.intersection(right, align=True)`.
For per-row Series arguments such as buffer distances, match the geometry index
before calling the method to avoid a `ValueError`.
Since 1.0, `sjoin` uses the named right index as the corresponding output-column
name. For a left spatial join that relies on `"index_right"`, check whether the
right index has a name before looking up that column.
### Geometry selection and deletion
Selecting columns that retain a geometry-typed column but omit the active one
returns a GeoDataFrame whose active geometry is unset. Call
`subset.set_geometry("alternate")` before using `subset.geometry` or `subset.crs`.
`del gdf["geometry"]` converts `gdf` to a pandas `DataFrame` if no geometry columns
remain after deletion.
### File-column and schema-version arguments
Since 1.0, `include_fields` and `ignore_fields` are deprecated for the default
Pyogrio engine. Pass the attributes to keep:
`geopandas.read_file("roads.gpkg", columns=["road_id"])`.
In GeoPandas 1.0, `to_parquet` and `to_feather` forward `version` to the underlying
Arrow writer. Select the geospatial metadata version explicitly with
`gdf.to_parquet("data.parquet", schema_version="1.0.0")`.
### Ordering, triangulation, and plot artists
- Since 1.0, `delaunay_triangles()` triangulates all input geometries together.
Use `shapely.delaunay_triangles(gdf.geometry)` to triangulate each row separately.
- The x-coordinate order of points in each `MultiPoint` from
`GeoSeries.sample_points()` is unspecified. Sort explicitly if ascending
x-coordinates are required.
- The composition of Matplotlib collections produced by GeoPandas plots has
changed. Check code that edits plot artists through `ax.collections` by position.
## Geometry quick reference
### Boolean spatial-index results
`SpatialIndex.query` can return boolean match arrays with `output_format="dense"`
or `output_format="sparse"`. Sparse output requires SciPy.
```python
import geopandas as gpd
points = gpd.GeoSeries.from_wkt(["POINT (0 0)", "POINT (1 1)"])
matches = points.sindex.query(points, output_format="sparse")
```
### Coverage validation and geometry repair
Use `is_valid_coverage()` on a GeoSeries or GeoDataFrame to check polygons as a
coverage, and `invalid_coverage_edges()` to locate invalidating edges.
GeoPandas 1.1 exposes repair algorithm and collapsed-component treatment through
`make_valid(method=..., keep_collapsed=...)`.
`gdf.geometry.make_valid(method="linework", keep_collapsed=True)` selects linework
repair and retains collapsed components.
### Unions and precision grids
`method="disjoint_subset"` processes non-intersecting subsets separately during a
union; in `dissolve`, it applies within each group.
```python
merged = gdf.geometry.union_all(method="disjoint_subset")
dissolved = gdf.dissolve("region", method="disjoint_subset")
```
Pass `grid_size` to `union`, `difference`, `symmetric_difference`, or `intersection`
to snap coordinates to a precision grid during the operation, for example
`left.intersection(right, grid_size=0.01)`.
### Grids, measures, and clipping order
`geopandas.make_grid` and `GeoSeries.make_grid` generate square or hexagonal grids
covering the input geometry.
Use `has_m` to detect measured geometries and `m` to read the measure from points.
Use `gdf.geometry.get_coordinates(include_m=True)` to include measures when
extracting coordinates.
Since 1.0, `gdf.clip(mask, sort=True)` preserves input row order when clipping.
## Data interchange and pandas quick reference
### Arrow conversion and Parquet
GeoPandas 1.0 adds `to_arrow()` and `from_arrow()` to both GeoSeries and GeoDataFrame
for interchange with GeoArrow extension types. A GeoDataFrame round trip is
`geopandas.GeoDataFrame.from_arrow(gdf.to_arrow())`.
Pass `to_pandas_kwargs` to `GeoDataFrame.from_arrow`, `read_parquet`, or
`read_feather` to control conversion of non-geometry Arrow columns to pandas.
`read_parquet` accepts it with Arrow list or struct columns too.
```python
import geopandas as gpd
import pandas as pd
gdf = gpd.read_parquet("data.parquet", to_pandas_kwargs={"types_mapper": pd.ArrowDtype})
```
GeoPandas can read and write files using the draft GeoParquet 2.0 specification.
`geopandas.read_parquet("https://example.org/data.parquet")` supports direct HTTP
and HTTPS reads. `gdf.to_parquet()` writes the frame's `attrs`, and
`geopandas.read_parquet()` restores them.
### Geometry accessor and named aggregation
Import `geopandas.accessors` to register `.geo` on pandas Series and call GeoSeries
methods on a Series holding geometries.
Named aggregations in `GroupBy.agg` can target geometry columns:
`gdf.groupby("region").agg(first_geometry=("geometry", "first"))` returns the first
geometry for each region under the name `first_geometry`.
## Sampling and plotting quick reference
### pointpats sampling
`GeoSeries.sample_points` accepts a list-like `size` with pointpats methods; supply
one count per input geometry. Pass `rng` to fix the random state with a pointpats
method.
```python
points = geometries.sample_points(size=[3, 5], method=method)
points = geometries.sample_points(size=5, method=method, rng=42)
```
The first example uses a two-geometry series; `method` is a pointpats sampler name.
Zero-area polygons such as collapsed rings yield an empty `MultiPoint`, avoiding
a stalled sampling call.
### Static maps and legends
Categorical plots accept category-to-color or other style mappings; categorical
colormaps assign colors to improve contrast. Matplotlib legends show geometry
types and styles, and `ax.legend()` can create one legend for a layered map.
For continuous data with a classification scheme, draw a colorbar with
`gdf.plot(column="population", scheme="quantiles", legend=True, legend_kwds={"colorbar": True})`.
Classified plots honor `vmin` and `vmax`; the colorbar shows extensions where those
bounds clip the values.
Pass a basemap through `tiles` to `gdf.plot()`; this requires contextily.
`polygons.plot(scheme="greedy")` gives adjacent polygons different colors and
requires mapclassify and libpysal. Static axes show CRS units; disable those labels
with `gdf.plot(add_labels=False)`.
### Index colors and interactive labels
`GeoDataFrame.plot` accepts a pandas `Index` for coloring geometries:
`gdf.plot(column=gdf.index)`.
`GeoDataFrame.explore()` honors `legend_kwds["labels"]` for categorical and boolean
columns, for example
`gdf.explore(column="is_open", legend_kwds={"labels": ["Closed", "Open"]})`.