terraproof 0.0.0-stage → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +356 -2
- package/bin/terraproof.js +4 -0
- package/dist/router/apply.js +147 -0
- package/dist/router/classify.js +111 -0
- package/dist/router/explain.js +9 -0
- package/dist/router/index.js +272 -0
- package/dist/router/resolve.js +239 -0
- package/dist/router/score.js +60 -0
- package/dist/router/types.js +1 -0
- package/dist/router/validate.js +81 -0
- package/instructions/engineering.md +14 -0
- package/instructions/security.md +14 -0
- package/instructions/simplicity.md +13 -0
- package/package.json +65 -4
- package/routing/DOMAIN_ROUTING.md +161 -0
- package/routing/ROUTER_DESIGN.md +173 -0
- package/routing/SKILL_MANIFEST.md +86 -0
- package/routing/checks.json +121 -0
- package/routing/collections.json +47 -0
- package/routing/registry.json +2211 -0
- package/routing/rules.json +64 -0
- package/skills/accuracy-assessment/SKILL.md +213 -0
- package/skills/accuracy-assessment/UPSTREAM.md +7 -0
- package/skills/accuracy-assessment/references/stratified-estimator.md +127 -0
- package/skills/accuracy-assessment/skill.json +103 -0
- package/skills/brainstorming/SKILL.md +250 -0
- package/skills/brainstorming/UPSTREAM.md +29 -0
- package/skills/brainstorming/scripts/frame-template.html +213 -0
- package/skills/brainstorming/scripts/helper.js +167 -0
- package/skills/brainstorming/scripts/server.cjs +723 -0
- package/skills/brainstorming/scripts/start-server.sh +209 -0
- package/skills/brainstorming/scripts/stop-server.sh +120 -0
- package/skills/brainstorming/skill.json +73 -0
- package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/skills/brainstorming/visual-companion.md +299 -0
- package/skills/crs-and-units/SKILL.md +200 -0
- package/skills/crs-and-units/UPSTREAM.md +7 -0
- package/skills/crs-and-units/skill.json +74 -0
- package/skills/design-postgis-tables/SKILL.md +494 -0
- package/skills/design-postgis-tables/UPSTREAM.md +21 -0
- package/skills/design-postgis-tables/skill.json +90 -0
- package/skills/gdal/SKILL.md +125 -0
- package/skills/gdal/UPSTREAM.md +22 -0
- package/skills/gdal/references/gdal-recipes.md +103 -0
- package/skills/gdal/skill.json +66 -0
- package/skills/geomaster/README.md +105 -0
- package/skills/geomaster/SKILL.md +366 -0
- package/skills/geomaster/UPSTREAM.md +21 -0
- package/skills/geomaster/references/advanced-gis.md +376 -0
- package/skills/geomaster/references/big-data.md +363 -0
- package/skills/geomaster/references/code-examples.md +531 -0
- package/skills/geomaster/references/coordinate-systems.md +364 -0
- package/skills/geomaster/references/core-libraries.md +273 -0
- package/skills/geomaster/references/data-sources.md +330 -0
- package/skills/geomaster/references/gis-software.md +369 -0
- package/skills/geomaster/references/industry-applications.md +420 -0
- package/skills/geomaster/references/machine-learning.md +462 -0
- package/skills/geomaster/references/programming-languages.md +456 -0
- package/skills/geomaster/references/remote-sensing.md +370 -0
- package/skills/geomaster/references/scientific-domains.md +416 -0
- package/skills/geomaster/references/specialized-topics.md +428 -0
- package/skills/geomaster/references/troubleshooting.md +439 -0
- package/skills/geomaster/skill.json +157 -0
- package/skills/geopandas/SKILL.md +250 -0
- package/skills/geopandas/UPSTREAM.md +22 -0
- package/skills/geopandas/references/crs-management.md +231 -0
- package/skills/geopandas/references/data-io.md +323 -0
- package/skills/geopandas/references/data-structures.md +207 -0
- package/skills/geopandas/references/geometric-operations.md +262 -0
- package/skills/geopandas/references/spatial-analysis.md +294 -0
- package/skills/geopandas/references/visualization.md +230 -0
- package/skills/geopandas/scripts/_common.py +605 -0
- package/skills/geopandas/scripts/crs_reprojection_plan.py +210 -0
- package/skills/geopandas/scripts/export_plan.py +305 -0
- package/skills/geopandas/scripts/geometry_validity_report.py +227 -0
- package/skills/geopandas/scripts/sensitive_coordinates_checklist.py +230 -0
- package/skills/geopandas/scripts/spatial_join_audit.py +368 -0
- package/skills/geopandas/scripts/vector_inventory.py +140 -0
- package/skills/geopandas/skill.json +116 -0
- package/skills/geoparquet-validation/SKILL.md +125 -0
- package/skills/geoparquet-validation/UPSTREAM.md +24 -0
- package/skills/geoparquet-validation/references/distribution-best-practices.md +118 -0
- package/skills/geoparquet-validation/references/gpio-commands.md +264 -0
- package/skills/geoparquet-validation/references/tool-comparison.md +155 -0
- package/skills/geoparquet-validation/skill.json +71 -0
- package/skills/geospatial-data-discovery/SKILL.md +49 -0
- package/skills/geospatial-data-discovery/UPSTREAM.md +15 -0
- package/skills/geospatial-data-discovery/skill.json +51 -0
- package/skills/geospatial-frontend/SKILL.md +86 -0
- package/skills/geospatial-frontend/UPSTREAM.md +23 -0
- package/skills/geospatial-frontend/references/design-system.md +283 -0
- package/skills/geospatial-frontend/references/user-preferences.md +96 -0
- package/skills/geospatial-frontend/skill.json +87 -0
- package/skills/geozarr/SKILL.md +244 -0
- package/skills/geozarr/UPSTREAM.md +21 -0
- package/skills/geozarr/skill.json +97 -0
- package/skills/networkx/SKILL.md +440 -0
- package/skills/networkx/UPSTREAM.md +22 -0
- package/skills/networkx/references/algorithms.md +384 -0
- package/skills/networkx/references/generators.md +385 -0
- package/skills/networkx/references/graph-basics.md +284 -0
- package/skills/networkx/references/io.md +457 -0
- package/skills/networkx/references/visualization.md +531 -0
- package/skills/networkx/skill.json +93 -0
- package/skills/raster-processing/SKILL.md +222 -0
- package/skills/raster-processing/UPSTREAM.md +7 -0
- package/skills/raster-processing/skill.json +81 -0
- package/skills/sar-basics/SKILL.md +202 -0
- package/skills/sar-basics/UPSTREAM.md +7 -0
- package/skills/sar-basics/references/calibration-lut.md +98 -0
- package/skills/sar-basics/skill.json +97 -0
- package/skills/satellite-preprocessing/SKILL.md +241 -0
- package/skills/satellite-preprocessing/UPSTREAM.md +7 -0
- package/skills/satellite-preprocessing/skill.json +84 -0
- package/skills/scientific-visualization/SKILL.md +285 -0
- package/skills/scientific-visualization/UPSTREAM.md +25 -0
- package/skills/scientific-visualization/assets/color_palettes.py +263 -0
- package/skills/scientific-visualization/assets/nature.mplstyle +68 -0
- package/skills/scientific-visualization/assets/presentation.mplstyle +68 -0
- package/skills/scientific-visualization/assets/publication.mplstyle +77 -0
- package/skills/scientific-visualization/assets/publisher_profiles.json +269 -0
- package/skills/scientific-visualization/references/color_palettes.md +227 -0
- package/skills/scientific-visualization/references/journal_requirements.md +169 -0
- package/skills/scientific-visualization/references/matplotlib_examples.md +336 -0
- package/skills/scientific-visualization/references/publication_guidelines.md +196 -0
- package/skills/scientific-visualization/references/sources.md +76 -0
- package/skills/scientific-visualization/scripts/_common.py +136 -0
- package/skills/scientific-visualization/scripts/export_plan.py +493 -0
- package/skills/scientific-visualization/scripts/figure_export.py +642 -0
- package/skills/scientific-visualization/scripts/image_metadata.py +731 -0
- package/skills/scientific-visualization/scripts/palette_audit.py +327 -0
- package/skills/scientific-visualization/scripts/style_presets.py +501 -0
- package/skills/scientific-visualization/scripts/style_preview.py +232 -0
- package/skills/scientific-visualization/skill.json +95 -0
- package/skills/spectral-indices/SKILL.md +235 -0
- package/skills/spectral-indices/UPSTREAM.md +7 -0
- package/skills/spectral-indices/skill.json +88 -0
- package/skills/stac-and-cloud-access/SKILL.md +209 -0
- package/skills/stac-and-cloud-access/UPSTREAM.md +7 -0
- package/skills/stac-and-cloud-access/references/run-manifest.md +94 -0
- package/skills/stac-and-cloud-access/skill.json +98 -0
- package/skills/statistical-analysis/SKILL.md +446 -0
- package/skills/statistical-analysis/UPSTREAM.md +24 -0
- package/skills/statistical-analysis/references/assumptions_and_diagnostics.md +379 -0
- package/skills/statistical-analysis/references/bayesian_statistics.md +686 -0
- package/skills/statistical-analysis/references/effect_sizes_and_power.md +649 -0
- package/skills/statistical-analysis/references/reporting_standards.md +482 -0
- package/skills/statistical-analysis/references/test_selection_guide.md +129 -0
- package/skills/statistical-analysis/scripts/assumption_checks.py +652 -0
- package/skills/statistical-analysis/skill.json +127 -0
- package/skills/systematic-debugging/SKILL.md +283 -0
- package/skills/systematic-debugging/UPSTREAM.md +28 -0
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/skills/systematic-debugging/find-polluter.sh +72 -0
- package/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/skills/systematic-debugging/skill.json +88 -0
- package/skills/time-series-and-change/SKILL.md +217 -0
- package/skills/time-series-and-change/UPSTREAM.md +7 -0
- package/skills/time-series-and-change/references/change-methods.md +42 -0
- package/skills/time-series-and-change/skill.json +116 -0
- package/skills/vector-quality/SKILL.md +204 -0
- package/skills/vector-quality/UPSTREAM.md +7 -0
- package/skills/vector-quality/skill.json +82 -0
- package/skills/verification/SKILL.md +120 -0
- package/skills/verification/UPSTREAM.md +31 -0
- package/skills/verification/skill.json +67 -0
- package/skills/writing-plans/SKILL.md +171 -0
- package/skills/writing-plans/UPSTREAM.md +23 -0
- package/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/skills/writing-plans/skill.json +80 -0
- package/sources/SOURCES.md +374 -0
- package/third_party/isaaccorley-geospatial-skills/LICENSE +176 -0
- package/third_party/isaaccorley-geospatial-skills/NOTICE.md +17 -0
- package/third_party/kdense-scientific-agent-skills/LICENSE +21 -0
- package/third_party/kdense-scientific-agent-skills/NOTICE.md +19 -0
- package/third_party/superpowers/LICENSE +21 -0
- package/third_party/superpowers/NOTICE.md +17 -0
- package/third_party/timescale-pg-aiguide/LICENSE +176 -0
- package/third_party/timescale-pg-aiguide/NOTICE.md +14 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: geopandas
|
|
3
|
+
description: Guidance and local audit tools for Python workflows that directly use GeoPandas GeoSeries, GeoDataFrame, spatial operations, or vector-data I/O.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Requires Python 3.10+ and uv. Bundled CLIs are local-only; runtime analysis requires the pinned GeoPandas stack below.
|
|
6
|
+
allowed-tools: Read Write Bash Glob Grep
|
|
7
|
+
metadata:
|
|
8
|
+
version: "1.1"
|
|
9
|
+
skill-author: K-Dense Inc.
|
|
10
|
+
last-reviewed: "2026-07-23"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# GeoPandas
|
|
14
|
+
|
|
15
|
+
Use GeoPandas for planar vector data represented as pandas-like `GeoSeries` and
|
|
16
|
+
`GeoDataFrame` objects. This skill targets stable **GeoPandas 1.1.4** (released
|
|
17
|
+
2026-06-26), not the unreleased 1.2 documentation.
|
|
18
|
+
|
|
19
|
+
## Reproducible environment
|
|
20
|
+
|
|
21
|
+
GeoPandas 1.1.4 requires Python 3.10+; its tagged source requires NumPy >=1.24,
|
|
22
|
+
pandas >=2.0, Shapely >=2.0, pyproj >=3.5, pyogrio >=0.7.2, and `packaging`.
|
|
23
|
+
This exact Python 3.12 snapshot was smoke-tested on 2026-07-23:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
uv venv --python 3.12
|
|
27
|
+
uv 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
|
+
|
|
38
|
+
Keep optional plotting and PostGIS packages pinned in the project lock as well.
|
|
39
|
+
Do 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
|
+
|
|
62
|
+
Apply these gates before trusting a result:
|
|
63
|
+
|
|
64
|
+
1. **Identity and provenance** — identify the source layer, stable feature key,
|
|
65
|
+
duplicate IDs, row count, geometry column, parser/driver, and content hash.
|
|
66
|
+
2. **Geometry state** — count null, empty, invalid, mixed, Z/M, and collapsed
|
|
67
|
+
geometries separately. `None` is missing; an empty Shapely geometry is real.
|
|
68
|
+
3. **CRS semantics** — require CRS metadata. `set_crs()` assigns metadata;
|
|
69
|
+
`to_crs()` transforms coordinates. Never guess a CRS from coordinate ranges.
|
|
70
|
+
4. **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.
|
|
74
|
+
5. **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.
|
|
77
|
+
6. **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.
|
|
80
|
+
7. **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.
|
|
83
|
+
8. **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
|
+
|
|
88
|
+
GeoPandas stores CRS as `pyproj.CRS`. Coordinate arrays use traditional GIS
|
|
89
|
+
`(x, y)` order, while authority definitions can advertise latitude-first axes.
|
|
90
|
+
Use `Transformer(..., always_xy=True)` for explicit coordinate-array pipelines,
|
|
91
|
+
and record that choice.
|
|
92
|
+
|
|
93
|
+
`to_crs()` transforms vertices and assumes each segment is straight in the
|
|
94
|
+
source CRS; it does not transform geodesic arcs. Geometries crossing ±180° or a
|
|
95
|
+
projection boundary can be badly wrapped. Detect crossings, split/unwrap and
|
|
96
|
+
densify in a documented geographic representation, transform parts, then
|
|
97
|
+
validate. Do not use Web Mercator as a general measurement CRS.
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
crs = gdf.crs # a pyproj.CRS when present
|
|
101
|
+
if crs is None or crs.is_geographic:
|
|
102
|
+
raise ValueError("Choose a justified projected CRS before planar measurement")
|
|
103
|
+
|
|
104
|
+
unit_names = [axis.unit_name for axis in crs.axis_info]
|
|
105
|
+
areas = gdf.geometry.area # square CRS units, not automatically square metres
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
See [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
|
+
|
|
122
|
+
See [data structures](references/data-structures.md).
|
|
123
|
+
|
|
124
|
+
### Geometry validity, precision, and union
|
|
125
|
+
|
|
126
|
+
Use `is_valid` and redacted `is_valid_reason()` categories before
|
|
127
|
+
`make_valid(method="linework"|"structure", keep_collapsed=...)`. Repair can
|
|
128
|
+
change geometry type or dimension; retain the original and compare counts,
|
|
129
|
+
area, types, empties, and collapsed parts.
|
|
130
|
+
|
|
131
|
+
`set_precision(grid_size, mode=...)` uses **CRS units** and may remove duplicate
|
|
132
|
+
vertices or collapse features. `union_all(method="unary", grid_size=...)` is the
|
|
133
|
+
robust default. Use `coverage` only after `is_valid_coverage()` proves
|
|
134
|
+
non-overlap and edge matching; use `disjoint_subset` with Shapely >=2.1 when its
|
|
135
|
+
partitioning assumption is useful.
|
|
136
|
+
|
|
137
|
+
See [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
|
+
|
|
155
|
+
See [spatial analysis](references/spatial-analysis.md).
|
|
156
|
+
|
|
157
|
+
### I/O, Arrow, and PostGIS
|
|
158
|
+
|
|
159
|
+
GeoPandas 1.x defaults to pyogrio. Driver availability and semantics come from
|
|
160
|
+
the installed GDAL, not GeoPandas alone. Prefer local GeoPackage for general
|
|
161
|
+
interchange and WKB GeoParquet for columnar interoperability.
|
|
162
|
+
|
|
163
|
+
GeoParquet defaults to stable schema 1.0.0. Native GeoArrow encodings and bbox
|
|
164
|
+
covering 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
|
|
166
|
+
them. Reopen and validate every export.
|
|
167
|
+
|
|
168
|
+
Use parameterized SQL and a SQLAlchemy `Engine`/`Connection` for PostGIS.
|
|
169
|
+
`if_exists="replace"` is destructive; default to `"fail"` and use a transaction.
|
|
170
|
+
|
|
171
|
+
See [data I/O](references/data-io.md).
|
|
172
|
+
|
|
173
|
+
## Migration checklist
|
|
174
|
+
|
|
175
|
+
For 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
|
+
|
|
199
|
+
Maps are analytical outputs: label units, classification method, missing data,
|
|
200
|
+
normalization denominator, and date. `explore()` can expose every attribute in
|
|
201
|
+
tooltips/popups and contact tile/CDN servers; generalize first and use
|
|
202
|
+
`tiles=None`, `tooltip=False`, and `popup=False` for a local draft.
|
|
203
|
+
|
|
204
|
+
See [visualization](references/visualization.md).
|
|
205
|
+
|
|
206
|
+
## Bundled local CLIs
|
|
207
|
+
|
|
208
|
+
All helpers are deterministic, reject network/archive paths, bound input bytes
|
|
209
|
+
and feature counts, keep imports lazy so `--help` is dependency-free, and emit
|
|
210
|
+
JSON 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
|
|
222
|
+
python skills/geopandas/scripts/vector_inventory.py --help
|
|
223
|
+
python skills/geopandas/scripts/crs_reprojection_plan.py \
|
|
224
|
+
--source-crs EPSG:4326 --target-crs EPSG:32631
|
|
225
|
+
python skills/geopandas/scripts/geometry_validity_report.py data.gpkg
|
|
226
|
+
python skills/geopandas/scripts/spatial_join_audit.py points.gpkg zones.gpkg \
|
|
227
|
+
--predicate within --left-id point_id --right-id zone_id
|
|
228
|
+
python 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
|
|
231
|
+
python 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).
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Upstream Attribution
|
|
2
|
+
|
|
3
|
+
This skill is derived from the `geopandas` skill in `K-Dense-AI/scientific-agent-skills`.
|
|
4
|
+
|
|
5
|
+
- **Upstream repository:** https://github.com/K-Dense-AI/scientific-agent-skills
|
|
6
|
+
- **Upstream path:** `skills/geopandas/`
|
|
7
|
+
- **License:** MIT (see [third_party/kdense-scientific-agent-skills/LICENSE](../../third_party/kdense-scientific-agent-skills/LICENSE))
|
|
8
|
+
- **Imported commit:** `390f5146bf3c1877cf15636a3dd7b775e4f0f185`
|
|
9
|
+
- **Import date:** 2026-08-25
|
|
10
|
+
- **Local path:** `skills/geopandas/`
|
|
11
|
+
|
|
12
|
+
## Imported Files
|
|
13
|
+
|
|
14
|
+
- `SKILL.md`
|
|
15
|
+
|
|
16
|
+
## Local modifications
|
|
17
|
+
|
|
18
|
+
Initial import:
|
|
19
|
+
- Local behavioral modifications: none (faithful vendoring, byte-for-byte identical to upstream).
|
|
20
|
+
- Upstream evals / tests: Vendored into `tests/upstream/kdense-scientific-agent-skills/geopandas/`.
|
|
21
|
+
|
|
22
|
+
Any future AgentLayer modifications must be documented here.
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# CRS, units, and reprojection
|
|
2
|
+
|
|
3
|
+
A CRS is part of the data model, not display metadata. An incorrect or missing
|
|
4
|
+
CRS can make numerically plausible results geographically wrong.
|
|
5
|
+
|
|
6
|
+
## Require authoritative CRS metadata
|
|
7
|
+
|
|
8
|
+
```python
|
|
9
|
+
from pyproj import CRS
|
|
10
|
+
|
|
11
|
+
if gdf.crs is None:
|
|
12
|
+
raise ValueError("CRS is missing; recover it from authoritative source metadata")
|
|
13
|
+
|
|
14
|
+
crs = CRS.from_user_input(gdf.crs)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Do not infer EPSG:4326 because values resemble longitude/latitude. Coordinate
|
|
18
|
+
ranges are not evidence of datum, axis interpretation, units, or epoch.
|
|
19
|
+
|
|
20
|
+
### `set_crs` versus `to_crs`
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
# Assign metadata only; coordinate numbers do not change.
|
|
24
|
+
gdf = gdf.set_crs("EPSG:4326")
|
|
25
|
+
|
|
26
|
+
# Transform coordinates; the source CRS must already be set.
|
|
27
|
+
projected = gdf.to_crs("EPSG:32631")
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- Use `set_crs()` only when the coordinate values are already expressed in that
|
|
31
|
+
CRS and metadata is absent or demonstrably wrong.
|
|
32
|
+
- Replacing existing metadata requires `allow_override=True`; record why.
|
|
33
|
+
- Use `to_crs()` to transform the active geometry column. Transform each
|
|
34
|
+
additional geometry column explicitly.
|
|
35
|
+
- Do not assign `gdf.crs = ...`; manual override is deprecated.
|
|
36
|
+
|
|
37
|
+
## Axis order
|
|
38
|
+
|
|
39
|
+
EPSG definitions can be latitude/longitude while GIS coordinate arrays are
|
|
40
|
+
normally x/y (longitude/latitude). Inspect the authority axes:
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
for axis in crs.axis_info:
|
|
44
|
+
print(axis.name, axis.abbrev, axis.direction, axis.unit_name)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
For explicit pyproj transformations, request traditional GIS x/y order:
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from pyproj import Transformer
|
|
51
|
+
|
|
52
|
+
transformer = Transformer.from_crs(
|
|
53
|
+
source_crs,
|
|
54
|
+
target_crs,
|
|
55
|
+
always_xy=True,
|
|
56
|
+
allow_ballpark=False,
|
|
57
|
+
only_best=True,
|
|
58
|
+
)
|
|
59
|
+
x_out, y_out = transformer.transform(x_in, y_in, errcheck=True)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Record `always_xy=True`; it changes the API coordinate order, not the CRS
|
|
63
|
+
definition. GeoParquet 1.1 explicitly stores WKB/native coordinates as x/y even
|
|
64
|
+
when the CRS authority uses another axis order.
|
|
65
|
+
|
|
66
|
+
## Units and planar operations
|
|
67
|
+
|
|
68
|
+
GeoPandas and Shapely compute planar Cartesian geometry and ignore Z:
|
|
69
|
+
|
|
70
|
+
- geographic longitude/latitude axes are angular, usually degrees;
|
|
71
|
+
- projected axes may be metres, US survey feet, feet, or another linear unit;
|
|
72
|
+
- `.area` returns squared coordinate units;
|
|
73
|
+
- `.length`, `.distance`, `.buffer`, `sjoin_nearest(max_distance=...)`,
|
|
74
|
+
`sjoin(predicate="dwithin", distance=...)`, precision grids, simplify
|
|
75
|
+
tolerances, and gap widths use coordinate units.
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
axis_units = [(axis.unit_name, axis.unit_conversion_factor) for axis in crs.axis_info]
|
|
79
|
+
if crs.is_geographic:
|
|
80
|
+
raise ValueError("Planar measurement on angular coordinates is not accepted")
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Do not label an output metres merely because a CRS is projected. Convert units
|
|
84
|
+
using the CRS axis metadata and document the conversion. Web Mercator
|
|
85
|
+
(`EPSG:3857`) is for web display, not general area/distance analysis.
|
|
86
|
+
|
|
87
|
+
### Choosing a measurement CRS
|
|
88
|
+
|
|
89
|
+
Choose based on the operation, study extent, datum, and required accuracy:
|
|
90
|
+
|
|
91
|
+
- local UTM or another local conformal CRS for local distances/angles;
|
|
92
|
+
- an equal-area CRS for area totals and areal normalization;
|
|
93
|
+
- an equidistant/azimuthal design for a specified distance origin;
|
|
94
|
+
- geodesic methods for large/global geographic extents.
|
|
95
|
+
|
|
96
|
+
`estimate_utm_crs()` is a convenience based on dataset bounds, not a proof of
|
|
97
|
+
suitability. It can be poor for multi-zone, polar, antimeridian-crossing, or
|
|
98
|
+
very large datasets.
|
|
99
|
+
|
|
100
|
+
## Geodesic measurements
|
|
101
|
+
|
|
102
|
+
When projection distortion is unacceptable, use the ellipsoid associated with
|
|
103
|
+
the CRS through `pyproj.Geod`, not Shapely's planar distance:
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
geod = crs.get_geod()
|
|
107
|
+
azimuth_fwd, azimuth_back, metres = geod.inv(lon1, lat1, lon2, lat2)
|
|
108
|
+
area_m2, perimeter_m = geod.geometry_area_perimeter(polygon)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Ensure inputs are longitude/latitude on the intended geodetic datum. Geodesic
|
|
112
|
+
area is signed according to ring orientation and has documented limitations for
|
|
113
|
+
very large polygons; normalize orientation and test known controls.
|
|
114
|
+
|
|
115
|
+
## Datum transformations and operation selection
|
|
116
|
+
|
|
117
|
+
The same source/target CRS pair can have several operations. Selection depends
|
|
118
|
+
on area of interest, installed grids, authority, and accuracy:
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
from pyproj.aoi import AreaOfInterest
|
|
122
|
+
from pyproj.transformer import TransformerGroup
|
|
123
|
+
from pyproj import network
|
|
124
|
+
|
|
125
|
+
network.set_network_enabled(False)
|
|
126
|
+
group = TransformerGroup(
|
|
127
|
+
source_crs,
|
|
128
|
+
target_crs,
|
|
129
|
+
always_xy=True,
|
|
130
|
+
area_of_interest=AreaOfInterest(west, south, east, north),
|
|
131
|
+
allow_ballpark=False,
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
if not group.best_available:
|
|
135
|
+
raise RuntimeError("Best transformation unavailable; inspect missing grids")
|
|
136
|
+
|
|
137
|
+
candidate = group.transformers[0]
|
|
138
|
+
print(candidate.description, candidate.accuracy, candidate.area_of_use)
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Privacy note: an exact area of interest can reveal a sensitive study location.
|
|
142
|
+
Do not log it; retain only an approved coarse region or protected audit record.
|
|
143
|
+
|
|
144
|
+
Operational rules:
|
|
145
|
+
|
|
146
|
+
1. Set `allow_ballpark=False` for accuracy-sensitive work.
|
|
147
|
+
2. Use `only_best=True` with `Transformer.from_crs()` when failure is preferable
|
|
148
|
+
to silently selecting a lower-quality operation.
|
|
149
|
+
3. Verify `accuracy` (`-1` means unknown) and `area_of_use`.
|
|
150
|
+
4. Inspect `TransformerGroup.unavailable_operations` for missing grids.
|
|
151
|
+
5. Keep PROJ network disabled by default. pyproj wheels do not include all
|
|
152
|
+
transformation grids; downloading grids is a separate, explicit network and
|
|
153
|
+
supply-chain action.
|
|
154
|
+
6. Record PROJ database/native versions and the selected operation description.
|
|
155
|
+
7. For dynamic CRS, record coordinate epoch. A CRS alone may be insufficient.
|
|
156
|
+
|
|
157
|
+
The bundled `scripts/crs_reprojection_plan.py` performs this inspection without
|
|
158
|
+
transforming coordinates or enabling network access.
|
|
159
|
+
|
|
160
|
+
## Geometry transformation caveat
|
|
161
|
+
|
|
162
|
+
`GeoDataFrame.to_crs()` transforms every existing vertex. It does not interpret
|
|
163
|
+
a segment as a geodesic arc:
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
out = gdf.to_crs(target_crs)
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
If source linework is sparse, densify according to a documented geodesic or
|
|
170
|
+
source-space tolerance before projection when shape fidelity matters. Validate
|
|
171
|
+
the resulting topology and bounds.
|
|
172
|
+
|
|
173
|
+
## Antimeridian and projection boundaries
|
|
174
|
+
|
|
175
|
+
`to_crs()` warns that objects crossing the dateline or another projection
|
|
176
|
+
boundary have undesirable behavior. A naive line from 179°E to 179°W can be
|
|
177
|
+
treated as spanning almost the whole map.
|
|
178
|
+
|
|
179
|
+
Safe workflow:
|
|
180
|
+
|
|
181
|
+
1. Normalize and validate longitude convention (`[-180, 180]` or `[0, 360)`).
|
|
182
|
+
2. Detect segment jumps and bbox representations that cross the antimeridian.
|
|
183
|
+
3. Split/unwrap at ±180° in a documented geographic CRS.
|
|
184
|
+
4. Densify geodesic edges if required by the accuracy target.
|
|
185
|
+
5. Transform each part with an operation valid for its area.
|
|
186
|
+
6. Reassemble only when target topology permits it.
|
|
187
|
+
7. Compare source/target control points, feature counts, validity, and bounds.
|
|
188
|
+
|
|
189
|
+
For transformed bounds, use `Transformer.transform_bounds(..., densify_pts=...)`.
|
|
190
|
+
When geographic output returns `right < left`, pyproj documents that the bounds
|
|
191
|
+
cross the antimeridian and should be represented as two polygons. Do not sort
|
|
192
|
+
the numbers and erase that meaning.
|
|
193
|
+
|
|
194
|
+
## CRS equality and concatenation
|
|
195
|
+
|
|
196
|
+
Compare semantic CRS objects, not raw WKT strings:
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
left_crs = CRS.from_user_input(left.crs)
|
|
200
|
+
right_crs = CRS.from_user_input(right.crs)
|
|
201
|
+
if not left_crs.equals(right_crs):
|
|
202
|
+
right = right.to_crs(left_crs)
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Equivalent does not mean equally appropriate for the analysis. Before concat,
|
|
206
|
+
join, overlay, or clip, require matching CRS and confirm both datasets use the
|
|
207
|
+
same coordinate epoch/realization where relevant.
|
|
208
|
+
|
|
209
|
+
## Reprojection provenance
|
|
210
|
+
|
|
211
|
+
Record:
|
|
212
|
+
|
|
213
|
+
- source and target CRS as WKT2/PROJJSON plus authority IDs when available;
|
|
214
|
+
- source of CRS assignment and any override;
|
|
215
|
+
- axis order exposed by the CRS and API order (`always_xy`);
|
|
216
|
+
- units and conversion factors;
|
|
217
|
+
- area of interest at an approved precision;
|
|
218
|
+
- chosen operation, expected accuracy, ballpark policy, and area of use;
|
|
219
|
+
- required/available grids, network policy, PROJ data/database versions;
|
|
220
|
+
- densification, antimeridian splitting, precision, and validation checks.
|
|
221
|
+
|
|
222
|
+
## Sources (verified 2026-07-23)
|
|
223
|
+
|
|
224
|
+
- [GeoPandas projections guide](https://geopandas.org/en/stable/docs/user_guide/projections.html).
|
|
225
|
+
- [GeoDataFrame.to_crs](https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoDataFrame.to_crs.html).
|
|
226
|
+
- [GeoDataFrame.set_crs](https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoDataFrame.set_crs.html).
|
|
227
|
+
- [pyproj Transformer API 3.7.2](https://pyproj4.github.io/pyproj/stable/api/transformer.html) — page updated 2025-07-02.
|
|
228
|
+
- [pyproj CRS API 3.7.2](https://pyproj4.github.io/pyproj/stable/api/crs/crs.html).
|
|
229
|
+
- [pyproj transformation grids](https://pyproj4.github.io/pyproj/stable/transformation_grids.html).
|
|
230
|
+
- [pyproj Geod API](https://pyproj4.github.io/pyproj/stable/api/geod.html).
|
|
231
|
+
- [GeoParquet 1.1.0 CRS and axis-order rules](https://geoparquet.org/releases/v1.1.0/).
|