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.
Files changed (182) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +356 -2
  3. package/bin/terraproof.js +4 -0
  4. package/dist/router/apply.js +147 -0
  5. package/dist/router/classify.js +111 -0
  6. package/dist/router/explain.js +9 -0
  7. package/dist/router/index.js +272 -0
  8. package/dist/router/resolve.js +239 -0
  9. package/dist/router/score.js +60 -0
  10. package/dist/router/types.js +1 -0
  11. package/dist/router/validate.js +81 -0
  12. package/instructions/engineering.md +14 -0
  13. package/instructions/security.md +14 -0
  14. package/instructions/simplicity.md +13 -0
  15. package/package.json +65 -4
  16. package/routing/DOMAIN_ROUTING.md +161 -0
  17. package/routing/ROUTER_DESIGN.md +173 -0
  18. package/routing/SKILL_MANIFEST.md +86 -0
  19. package/routing/checks.json +121 -0
  20. package/routing/collections.json +47 -0
  21. package/routing/registry.json +2211 -0
  22. package/routing/rules.json +64 -0
  23. package/skills/accuracy-assessment/SKILL.md +213 -0
  24. package/skills/accuracy-assessment/UPSTREAM.md +7 -0
  25. package/skills/accuracy-assessment/references/stratified-estimator.md +127 -0
  26. package/skills/accuracy-assessment/skill.json +103 -0
  27. package/skills/brainstorming/SKILL.md +250 -0
  28. package/skills/brainstorming/UPSTREAM.md +29 -0
  29. package/skills/brainstorming/scripts/frame-template.html +213 -0
  30. package/skills/brainstorming/scripts/helper.js +167 -0
  31. package/skills/brainstorming/scripts/server.cjs +723 -0
  32. package/skills/brainstorming/scripts/start-server.sh +209 -0
  33. package/skills/brainstorming/scripts/stop-server.sh +120 -0
  34. package/skills/brainstorming/skill.json +73 -0
  35. package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  36. package/skills/brainstorming/visual-companion.md +299 -0
  37. package/skills/crs-and-units/SKILL.md +200 -0
  38. package/skills/crs-and-units/UPSTREAM.md +7 -0
  39. package/skills/crs-and-units/skill.json +74 -0
  40. package/skills/design-postgis-tables/SKILL.md +494 -0
  41. package/skills/design-postgis-tables/UPSTREAM.md +21 -0
  42. package/skills/design-postgis-tables/skill.json +90 -0
  43. package/skills/gdal/SKILL.md +125 -0
  44. package/skills/gdal/UPSTREAM.md +22 -0
  45. package/skills/gdal/references/gdal-recipes.md +103 -0
  46. package/skills/gdal/skill.json +66 -0
  47. package/skills/geomaster/README.md +105 -0
  48. package/skills/geomaster/SKILL.md +366 -0
  49. package/skills/geomaster/UPSTREAM.md +21 -0
  50. package/skills/geomaster/references/advanced-gis.md +376 -0
  51. package/skills/geomaster/references/big-data.md +363 -0
  52. package/skills/geomaster/references/code-examples.md +531 -0
  53. package/skills/geomaster/references/coordinate-systems.md +364 -0
  54. package/skills/geomaster/references/core-libraries.md +273 -0
  55. package/skills/geomaster/references/data-sources.md +330 -0
  56. package/skills/geomaster/references/gis-software.md +369 -0
  57. package/skills/geomaster/references/industry-applications.md +420 -0
  58. package/skills/geomaster/references/machine-learning.md +462 -0
  59. package/skills/geomaster/references/programming-languages.md +456 -0
  60. package/skills/geomaster/references/remote-sensing.md +370 -0
  61. package/skills/geomaster/references/scientific-domains.md +416 -0
  62. package/skills/geomaster/references/specialized-topics.md +428 -0
  63. package/skills/geomaster/references/troubleshooting.md +439 -0
  64. package/skills/geomaster/skill.json +157 -0
  65. package/skills/geopandas/SKILL.md +250 -0
  66. package/skills/geopandas/UPSTREAM.md +22 -0
  67. package/skills/geopandas/references/crs-management.md +231 -0
  68. package/skills/geopandas/references/data-io.md +323 -0
  69. package/skills/geopandas/references/data-structures.md +207 -0
  70. package/skills/geopandas/references/geometric-operations.md +262 -0
  71. package/skills/geopandas/references/spatial-analysis.md +294 -0
  72. package/skills/geopandas/references/visualization.md +230 -0
  73. package/skills/geopandas/scripts/_common.py +605 -0
  74. package/skills/geopandas/scripts/crs_reprojection_plan.py +210 -0
  75. package/skills/geopandas/scripts/export_plan.py +305 -0
  76. package/skills/geopandas/scripts/geometry_validity_report.py +227 -0
  77. package/skills/geopandas/scripts/sensitive_coordinates_checklist.py +230 -0
  78. package/skills/geopandas/scripts/spatial_join_audit.py +368 -0
  79. package/skills/geopandas/scripts/vector_inventory.py +140 -0
  80. package/skills/geopandas/skill.json +116 -0
  81. package/skills/geoparquet-validation/SKILL.md +125 -0
  82. package/skills/geoparquet-validation/UPSTREAM.md +24 -0
  83. package/skills/geoparquet-validation/references/distribution-best-practices.md +118 -0
  84. package/skills/geoparquet-validation/references/gpio-commands.md +264 -0
  85. package/skills/geoparquet-validation/references/tool-comparison.md +155 -0
  86. package/skills/geoparquet-validation/skill.json +71 -0
  87. package/skills/geospatial-data-discovery/SKILL.md +49 -0
  88. package/skills/geospatial-data-discovery/UPSTREAM.md +15 -0
  89. package/skills/geospatial-data-discovery/skill.json +51 -0
  90. package/skills/geospatial-frontend/SKILL.md +86 -0
  91. package/skills/geospatial-frontend/UPSTREAM.md +23 -0
  92. package/skills/geospatial-frontend/references/design-system.md +283 -0
  93. package/skills/geospatial-frontend/references/user-preferences.md +96 -0
  94. package/skills/geospatial-frontend/skill.json +87 -0
  95. package/skills/geozarr/SKILL.md +244 -0
  96. package/skills/geozarr/UPSTREAM.md +21 -0
  97. package/skills/geozarr/skill.json +97 -0
  98. package/skills/networkx/SKILL.md +440 -0
  99. package/skills/networkx/UPSTREAM.md +22 -0
  100. package/skills/networkx/references/algorithms.md +384 -0
  101. package/skills/networkx/references/generators.md +385 -0
  102. package/skills/networkx/references/graph-basics.md +284 -0
  103. package/skills/networkx/references/io.md +457 -0
  104. package/skills/networkx/references/visualization.md +531 -0
  105. package/skills/networkx/skill.json +93 -0
  106. package/skills/raster-processing/SKILL.md +222 -0
  107. package/skills/raster-processing/UPSTREAM.md +7 -0
  108. package/skills/raster-processing/skill.json +81 -0
  109. package/skills/sar-basics/SKILL.md +202 -0
  110. package/skills/sar-basics/UPSTREAM.md +7 -0
  111. package/skills/sar-basics/references/calibration-lut.md +98 -0
  112. package/skills/sar-basics/skill.json +97 -0
  113. package/skills/satellite-preprocessing/SKILL.md +241 -0
  114. package/skills/satellite-preprocessing/UPSTREAM.md +7 -0
  115. package/skills/satellite-preprocessing/skill.json +84 -0
  116. package/skills/scientific-visualization/SKILL.md +285 -0
  117. package/skills/scientific-visualization/UPSTREAM.md +25 -0
  118. package/skills/scientific-visualization/assets/color_palettes.py +263 -0
  119. package/skills/scientific-visualization/assets/nature.mplstyle +68 -0
  120. package/skills/scientific-visualization/assets/presentation.mplstyle +68 -0
  121. package/skills/scientific-visualization/assets/publication.mplstyle +77 -0
  122. package/skills/scientific-visualization/assets/publisher_profiles.json +269 -0
  123. package/skills/scientific-visualization/references/color_palettes.md +227 -0
  124. package/skills/scientific-visualization/references/journal_requirements.md +169 -0
  125. package/skills/scientific-visualization/references/matplotlib_examples.md +336 -0
  126. package/skills/scientific-visualization/references/publication_guidelines.md +196 -0
  127. package/skills/scientific-visualization/references/sources.md +76 -0
  128. package/skills/scientific-visualization/scripts/_common.py +136 -0
  129. package/skills/scientific-visualization/scripts/export_plan.py +493 -0
  130. package/skills/scientific-visualization/scripts/figure_export.py +642 -0
  131. package/skills/scientific-visualization/scripts/image_metadata.py +731 -0
  132. package/skills/scientific-visualization/scripts/palette_audit.py +327 -0
  133. package/skills/scientific-visualization/scripts/style_presets.py +501 -0
  134. package/skills/scientific-visualization/scripts/style_preview.py +232 -0
  135. package/skills/scientific-visualization/skill.json +95 -0
  136. package/skills/spectral-indices/SKILL.md +235 -0
  137. package/skills/spectral-indices/UPSTREAM.md +7 -0
  138. package/skills/spectral-indices/skill.json +88 -0
  139. package/skills/stac-and-cloud-access/SKILL.md +209 -0
  140. package/skills/stac-and-cloud-access/UPSTREAM.md +7 -0
  141. package/skills/stac-and-cloud-access/references/run-manifest.md +94 -0
  142. package/skills/stac-and-cloud-access/skill.json +98 -0
  143. package/skills/statistical-analysis/SKILL.md +446 -0
  144. package/skills/statistical-analysis/UPSTREAM.md +24 -0
  145. package/skills/statistical-analysis/references/assumptions_and_diagnostics.md +379 -0
  146. package/skills/statistical-analysis/references/bayesian_statistics.md +686 -0
  147. package/skills/statistical-analysis/references/effect_sizes_and_power.md +649 -0
  148. package/skills/statistical-analysis/references/reporting_standards.md +482 -0
  149. package/skills/statistical-analysis/references/test_selection_guide.md +129 -0
  150. package/skills/statistical-analysis/scripts/assumption_checks.py +652 -0
  151. package/skills/statistical-analysis/skill.json +127 -0
  152. package/skills/systematic-debugging/SKILL.md +283 -0
  153. package/skills/systematic-debugging/UPSTREAM.md +28 -0
  154. package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  155. package/skills/systematic-debugging/condition-based-waiting.md +115 -0
  156. package/skills/systematic-debugging/defense-in-depth.md +122 -0
  157. package/skills/systematic-debugging/find-polluter.sh +72 -0
  158. package/skills/systematic-debugging/root-cause-tracing.md +169 -0
  159. package/skills/systematic-debugging/skill.json +88 -0
  160. package/skills/time-series-and-change/SKILL.md +217 -0
  161. package/skills/time-series-and-change/UPSTREAM.md +7 -0
  162. package/skills/time-series-and-change/references/change-methods.md +42 -0
  163. package/skills/time-series-and-change/skill.json +116 -0
  164. package/skills/vector-quality/SKILL.md +204 -0
  165. package/skills/vector-quality/UPSTREAM.md +7 -0
  166. package/skills/vector-quality/skill.json +82 -0
  167. package/skills/verification/SKILL.md +120 -0
  168. package/skills/verification/UPSTREAM.md +31 -0
  169. package/skills/verification/skill.json +67 -0
  170. package/skills/writing-plans/SKILL.md +171 -0
  171. package/skills/writing-plans/UPSTREAM.md +23 -0
  172. package/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
  173. package/skills/writing-plans/skill.json +80 -0
  174. package/sources/SOURCES.md +374 -0
  175. package/third_party/isaaccorley-geospatial-skills/LICENSE +176 -0
  176. package/third_party/isaaccorley-geospatial-skills/NOTICE.md +17 -0
  177. package/third_party/kdense-scientific-agent-skills/LICENSE +21 -0
  178. package/third_party/kdense-scientific-agent-skills/NOTICE.md +19 -0
  179. package/third_party/superpowers/LICENSE +21 -0
  180. package/third_party/superpowers/NOTICE.md +17 -0
  181. package/third_party/timescale-pg-aiguide/LICENSE +176 -0
  182. package/third_party/timescale-pg-aiguide/NOTICE.md +14 -0
@@ -0,0 +1,125 @@
1
+ ---
2
+ name: geoparquet-validation
3
+ description: This skill should be used when working with gpio for GeoParquet inspection, validation, optimization, and distribution. Covers GeoParquet best practices using gpio CLI and DuckDB.
4
+ ---
5
+
6
+ # GeoParquet Validation Skill
7
+
8
+ Guide users through GeoParquet workflows with a `gpio`-first approach: inspect, validate, optimize, and distribute GeoParquet files following current best practices.
9
+
10
+ ## What this skill is for
11
+
12
+ Use this skill when the user is working with GeoParquet files and needs:
13
+
14
+ - metadata inspection
15
+ - validation and auto-fix workflows
16
+ - conversion and optimization with `gpio`
17
+ - partitioning and publishing
18
+ - DuckDB support for heavier SQL transforms
19
+
20
+ This is not a general "anything about GeoParquet" skill. It is centered on the `gpio` toolchain.
21
+
22
+ ## Tools
23
+
24
+ ### gpio (geoparquet-io) - Preferred
25
+
26
+ Always prefer `gpio` for GeoParquet operations. It applies important best practices by default.
27
+
28
+ **Installation:**
29
+
30
+ ```bash
31
+ pipx install --pre geoparquet-io
32
+ pip install --pre geoparquet-io
33
+ uv pip install --pre geoparquet-io
34
+ ```
35
+
36
+ If `gpio` is missing, guide the user through installation before proceeding.
37
+
38
+ ### DuckDB - For Advanced Operations
39
+
40
+ Use DuckDB for complex SQL, joins, aggregations, or geometry operations.
41
+
42
+ ```bash
43
+ pip install "duckdb>=1.5"
44
+ ```
45
+
46
+ When using DuckDB, apply GeoParquet best practices manually:
47
+
48
+ - `ORDER BY ST_Hilbert(geometry)`
49
+ - `COMPRESSION ZSTD` with `COMPRESSION_LEVEL 15`
50
+ - `ROW_GROUP_SIZE 100000`
51
+ - validate output with `gpio check all`
52
+
53
+ ## Workflow
54
+
55
+ ### 1. Inspect
56
+
57
+ ```bash
58
+ gpio inspect <file>
59
+ gpio inspect stats <file>
60
+ ```
61
+
62
+ Report row count, geometry type, CRS, columns, and file size.
63
+
64
+ **`gpio inspect` and `gpio check` accept only (Geo)Parquet files.** For non-Parquet sources (shapefile, GPKG, GeoJSON, FGB), skip pre-inspection — convert first, then inspect the output. Do not spend calls pre-inspecting a non-Parquet source unless the conversion fails; if you truly need source metadata first, use `pyogrio.read_info("<src>")`.
65
+
66
+ ### 2. Convert or optimize
67
+
68
+ ```bash
69
+ gpio convert geoparquet <input> <output> # input: any OGR-readable format (shp, gpkg, geojson, fgb, csv)
70
+ gpio convert geoparquet <input> <output> --compression-level 15
71
+ ```
72
+
73
+ `convert` applies best practices by default (Hilbert sort, bbox covering column, ZSTD) and validates its own output — a clean convert rarely needs `--fix` afterwards.
74
+
75
+ ### 3. Validate
76
+
77
+ ```bash
78
+ gpio check all <file>
79
+ gpio check all <file> --fix --output <fixed>
80
+ ```
81
+
82
+ `check all` passes when Spec Validation reports every check with a checkmark. Lines marked as informational (the "GeoParquet 2.0 is available" pointer in particular) are not failures — stay on 1.1.0, the widest-compatibility version, unless the user explicitly asks for 2.0. `convert` and `check all` already print file size and row-group stats; one `gpio inspect` on the final output is enough for reporting.
83
+
84
+ ### 4. Scale based on size
85
+
86
+ - Small: single file, Hilbert sorted, bbox column
87
+ - Medium: single file, covering metadata, compression level 15
88
+ - Large: partition with kdtree/admin/quadkey and generate STAC
89
+
90
+ ### 5. Publish
91
+
92
+ ```bash
93
+ gpio publish stac <input> <output.json>
94
+ gpio publish upload <file> s3://bucket/path/
95
+ ```
96
+
97
+ ## Quick Reference
98
+
99
+ ```bash
100
+ # Inspect (Parquet input only)
101
+ gpio inspect <file>
102
+ gpio inspect stats <file>
103
+
104
+ # Convert (input: any OGR-readable format — shp, gpkg, geojson, fgb, csv)
105
+ gpio convert geoparquet <input> <output>
106
+ gpio convert geoparquet <input> <output> --compression-level 15
107
+
108
+ # Validate
109
+ gpio check all <file>
110
+ gpio check all <file> --fix --output <fixed>
111
+
112
+ # Extract
113
+ gpio extract <input> <output> --bbox "minx,miny,maxx,maxy"
114
+ gpio extract <input> <output> --where "column > value"
115
+
116
+ # Partition and publish
117
+ gpio partition kdtree <input> <output_dir> --max-rows-per-file 500000
118
+ gpio publish stac <input> <output.json>
119
+ ```
120
+
121
+ ## References
122
+
123
+ - `references/gpio-commands.md`
124
+ - `references/distribution-best-practices.md`
125
+ - `references/tool-comparison.md`
@@ -0,0 +1,24 @@
1
+ # Upstream Attribution
2
+
3
+ This skill is derived from the `geoparquet-validation` skill in `isaaccorley/geospatial-skills`.
4
+
5
+ - **Upstream repository:** https://github.com/isaaccorley/geospatial-skills
6
+ - **Upstream path:** `skills/geoparquet-validation/`
7
+ - **License:** Apache-2.0 (see [third_party/isaaccorley-geospatial-skills/LICENSE](../../third_party/isaaccorley-geospatial-skills/LICENSE))
8
+ - **Imported commit:** `a203446cb997cd1dbf054918b1021a6040b69824`
9
+ - **Import date:** 2026-08-25
10
+ - **Local path:** `skills/geoparquet-validation/`
11
+
12
+ ## Imported Files
13
+
14
+ - `SKILL.md`
15
+ - `references/distribution-best-practices.md`
16
+ - `references/gpio-commands.md`
17
+ - `references/tool-comparison.md`
18
+
19
+ ## Local modifications
20
+
21
+ Initial import:
22
+ - Local behavioral modifications: none (faithful vendoring, byte-for-byte identical to upstream).
23
+
24
+ Any future AgentLayer modifications must be documented here.
@@ -0,0 +1,118 @@
1
+ # GeoParquet Distribution Best Practices
2
+
3
+ When preparing GeoParquet files for public distribution or cloud storage, optimize for query performance and size efficiency.
4
+
5
+ ## Compression
6
+
7
+ Use zstd compression at level 15 for distribution:
8
+
9
+ ```bash
10
+ # gpio uses zstd by default (level 3 for speed during development)
11
+ # For distribution, use higher compression:
12
+ gpio convert geoparquet input.geojson output.parquet --compression-level 15
13
+ ```
14
+
15
+ This typically reduces file size by 10-30% compared to the default level 3, with slower write times but similar read performance.
16
+
17
+ ## Spatial Ordering (Critical)
18
+
19
+ Always apply spatial sorting to improve query locality and compression:
20
+
21
+ ```bash
22
+ # gpio applies Hilbert sorting by default
23
+ gpio convert geoparquet input.geojson output.parquet
24
+
25
+ # Explicit Hilbert sort on existing file
26
+ gpio sort hilbert input.parquet output.parquet
27
+ ```
28
+
29
+ Hilbert sorting places nearby features close together in the file, which:
30
+
31
+ - Improves bbox filter performance
32
+ - Increases compression ratio
33
+ - Makes row groups spatially coherent
34
+
35
+ ## Bbox Column + Covering Metadata
36
+
37
+ Add a bbox column for fast spatial filtering:
38
+
39
+ ```bash
40
+ # Add bbox column
41
+ gpio add bbox input.parquet output.parquet
42
+
43
+ # Add covering metadata to existing bbox column
44
+ gpio add bbox input.parquet output.parquet --bbox-column bbox
45
+ ```
46
+
47
+ The bbox column stores feature bounding boxes as a fixed-size list column. Covering metadata tells query engines how to use it for predicate pushdown.
48
+
49
+ ## Row Group Size
50
+
51
+ For queryable cloud-native files, target row groups of 50k-150k rows:
52
+
53
+ - **Too small** (\<10k): Too much metadata overhead
54
+ - **Too large** (>500k): Poor query selectivity, reads too much data
55
+ - **Sweet spot**: 100k rows for most datasets
56
+
57
+ With DuckDB:
58
+
59
+ ```sql
60
+ COPY my_table TO 'output.parquet'
61
+ (FORMAT parquet, ROW_GROUP_SIZE 100000, COMPRESSION zstd, COMPRESSION_LEVEL 15);
62
+ ```
63
+
64
+ ## Partitioning Large Datasets
65
+
66
+ For datasets >2GB or >10M features, partition into multiple files:
67
+
68
+ ```bash
69
+ # KD-tree partitioning (recommended for balanced files)
70
+ gpio partition kdtree input.parquet output_dir/ --max-rows-per-file 500000
71
+
72
+ # Admin boundary partitioning
73
+ gpio partition admin input.parquet output_dir/ --by country
74
+
75
+ # Quadkey grid partitioning
76
+ gpio partition quadkey input.parquet output_dir/ --zoom 8
77
+ ```
78
+
79
+ Use partitioning when:
80
+
81
+ - Single file exceeds 2GB
82
+ - Features are geographically distributed across continents/countries
83
+ - Users typically query subsets by region
84
+
85
+ ## STAC Metadata
86
+
87
+ Generate STAC for discoverability:
88
+
89
+ ```bash
90
+ # Single file
91
+ gpio publish stac output.parquet output.stac.json
92
+
93
+ # Partitioned directory (creates Collection + Items)
94
+ gpio publish stac output_dir/ stac/
95
+ ```
96
+
97
+ Include in STAC:
98
+
99
+ - Spatial extent
100
+ - Temporal extent (if applicable)
101
+ - CRS
102
+ - Geometry types
103
+ - License
104
+ - Provider/creator metadata
105
+
106
+ ## Summary Checklist
107
+
108
+ Before distribution:
109
+
110
+ - [ ] zstd compression level 15
111
+ - [ ] Hilbert sorted
112
+ - [ ] bbox column added
113
+ - [ ] Covering metadata present
114
+ - [ ] Row groups ~100k rows
115
+ - [ ] Partitioned if >2GB
116
+ - [ ] STAC metadata generated
117
+ - [ ] Uploaded to cloud/object storage
118
+ - [ ] Validated with `gpio check all`
@@ -0,0 +1,264 @@
1
+ # gpio Command Reference
2
+
3
+ Quick reference for the most common `gpio` commands when working with GeoParquet.
4
+
5
+ ## Inspection & Analysis
6
+
7
+ `inspect` and `check` read only (Geo)Parquet files — for shapefile/GPKG/GeoJSON sources, convert first and inspect the output.
8
+
9
+ ```bash
10
+ # Quick overview
11
+ gpio inspect file.parquet
12
+
13
+ # Preview rows
14
+ gpio inspect head file.parquet
15
+
16
+ # Statistics
17
+ gpio inspect stats file.parquet
18
+
19
+ # Full metadata (GeoParquet spec, Parquet structure)
20
+ gpio inspect metadata file.parquet
21
+ ```
22
+
23
+ ## Validation
24
+
25
+ ```bash
26
+ # Run all checks
27
+ gpio check all file.parquet
28
+
29
+ # Individual checks
30
+ gpio check metadata file.parquet
31
+ gpio check bbox file.parquet
32
+ gpio check encoding file.parquet
33
+ gpio check covering file.parquet
34
+
35
+ # Auto-fix issues
36
+ gpio check all input.parquet --fix --output fixed.parquet
37
+ ```
38
+
39
+ ## Format Conversion
40
+
41
+ ```bash
42
+ # Convert to GeoParquet (Hilbert sorted by default)
43
+ gpio convert geoparquet input.geojson output.parquet
44
+
45
+ # Skip Hilbert sorting (faster, less optimized)
46
+ gpio convert geoparquet input.geojson output.parquet --no-sort
47
+
48
+ # High compression for distribution
49
+ gpio convert geoparquet input.geojson output.parquet --compression-level 15
50
+
51
+ # Convert GeoParquet to GeoJSON
52
+ gpio convert geojson input.parquet output.geojson
53
+
54
+ # Reproject
55
+ gpio convert geoparquet input.geojson output.parquet --to-crs EPSG:4326
56
+ ```
57
+
58
+ ## Data Extraction & Subsetting
59
+
60
+ Works on local files, URLs, and cloud storage paths.
61
+
62
+ ```bash
63
+ # Extract by bounding box (uses bbox column for fast filtering)
64
+ gpio extract input.parquet output.parquet --bbox "-74.1,40.7,-73.9,40.8"
65
+
66
+ # Extract by geometry (GeoJSON, WKT, or file)
67
+ gpio extract input.parquet output.parquet --geometry polygon.geojson
68
+
69
+ # Select specific columns
70
+ gpio extract input.parquet output.parquet --select "id,name,geometry"
71
+
72
+ # Exclude columns
73
+ gpio extract input.parquet output.parquet --exclude "large_blob"
74
+
75
+ # SQL WHERE filter
76
+ gpio extract input.parquet output.parquet --where "population > 100000"
77
+
78
+ # Limit rows
79
+ gpio extract input.parquet output.parquet --limit 1000
80
+
81
+ # Combine filters
82
+ gpio extract input.parquet output.parquet \
83
+ --bbox "-74.1,40.7,-73.9,40.8" \
84
+ --where "population > 100000" \
85
+ --select "id,name,population,geometry"
86
+ ```
87
+
88
+ ## Merging Files
89
+
90
+ ```bash
91
+ # Merge multiple files with glob pattern
92
+ gpio merge "tiles/*.parquet" merged.parquet
93
+
94
+ # Extract from remote files (efficient - only downloads needed data)
95
+ gpio merge "s3://bucket/tiles/*.parquet" merged.parquet \
96
+ --bbox "-74.1,40.7,-73.9,40.8"
97
+ ```
98
+
99
+ ## Extract from BigQuery
100
+
101
+ Requires BigQuery access and credentials configured.
102
+
103
+ ```bash
104
+ # Extract entire table
105
+ gpio extract bigquery project.dataset.table output.parquet
106
+
107
+ # With filtering (pushed to BigQuery for efficiency)
108
+ gpio extract bigquery project.dataset.table output.parquet \
109
+ --where "state = 'CA'" \
110
+ --select "id,name,geometry"
111
+
112
+ # Select specific columns
113
+ gpio extract bigquery project.dataset.table output.parquet \
114
+ --select "id,geometry"
115
+
116
+ # Using service account
117
+ GOOGLE_APPLICATION_CREDENTIALS=key.json \
118
+ gpio extract bigquery project.dataset.table output.parquet
119
+ ```
120
+
121
+ ## Extract from ArcGIS Feature Services
122
+
123
+ ```bash
124
+ # Public service (no auth)
125
+ gpio extract arcgis \
126
+ "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3" \
127
+ output.parquet
128
+
129
+ # With server-side filtering (efficient - reduces download)
130
+ gpio extract arcgis \
131
+ "https://...FeatureServer/0" \
132
+ output.parquet \
133
+ --where "POPULATION > 100000"
134
+
135
+ # With authentication
136
+ gpio extract arcgis \
137
+ "https://...FeatureServer/0" \
138
+ output.parquet \
139
+ --token "$ARCGIS_TOKEN"
140
+ ```
141
+
142
+ ## Sorting
143
+
144
+ ```bash
145
+ # Hilbert curve (best for spatial queries)
146
+ gpio sort hilbert input.parquet output.parquet
147
+
148
+ # Sort by column
149
+ gpio sort values input.parquet output.parquet --by "timestamp"
150
+
151
+ # Quadkey ordering
152
+ gpio sort quadkey input.parquet output.parquet --zoom 8
153
+ ```
154
+
155
+ ## Adding Columns & Spatial Indices
156
+
157
+ ```bash
158
+ # Bbox column + covering metadata
159
+ gpio add bbox input.parquet output.parquet
160
+
161
+ # H3 hexagonal cells (resolution 0-15, default 9)
162
+ # Res 7: ~5km2, Res 9: ~105m2, Res 11: ~2m2
163
+ gpio add h3 input.parquet output.parquet --resolution 9
164
+
165
+ # S2 spherical cells (level 0-30, default 13)
166
+ # Level 8: ~1,250km2, Level 13: ~1.2km2, Level 18: ~1,200m2
167
+ gpio add s2 input.parquet output.parquet --level 13
168
+
169
+ # Quadkey (Bing Maps tiles)
170
+ gpio add quadkey input.parquet output.parquet --zoom 12
171
+
172
+ # A5 cells
173
+ gpio add a5 input.parquet output.parquet --resolution 9
174
+
175
+ # KD-tree cell IDs (for balanced partitioning)
176
+ gpio add kdtree input.parquet output.parquet --max-features-per-cell 500000
177
+
178
+ # Administrative divisions via spatial join
179
+ # GAUL dataset: adds gaul_continent, gaul_country, gaul_department
180
+ gpio add admin-divisions input.parquet output.parquet --dataset gaul
181
+
182
+ # Overture Maps: adds overture_country, overture_region
183
+ gpio add admin-divisions input.parquet output.parquet --dataset overture
184
+
185
+ # Select specific levels
186
+ gpio add admin-divisions input.parquet output.parquet \
187
+ --dataset gaul --levels country,department
188
+
189
+ # Custom column prefix
190
+ gpio add admin-divisions input.parquet output.parquet \
191
+ --dataset gaul --prefix admin_
192
+ ```
193
+
194
+ ## Partitioning
195
+
196
+ ```bash
197
+ # KD-tree (balanced file sizes)
198
+ gpio partition kdtree input.parquet output_dir/ --max-rows-per-file 500000
199
+
200
+ # Admin boundaries
201
+ gpio partition admin input.parquet output_dir/ --by country
202
+
203
+ # Quadkey grid
204
+ gpio partition quadkey input.parquet output_dir/ --zoom 8
205
+
206
+ # By column value
207
+ gpio partition values input.parquet output_dir/ --by state
208
+ ```
209
+
210
+ ## Publishing
211
+
212
+ ```bash
213
+ # Generate STAC metadata
214
+ gpio publish stac input.parquet output.stac.json
215
+
216
+ # Upload to S3
217
+ gpio publish upload input.parquet s3://my-bucket/data/
218
+ ```
219
+
220
+ ## Remote Files
221
+
222
+ ```bash
223
+ # gpio can read from cloud storage directly
224
+ gpio inspect s3://bucket/data.parquet
225
+ gpio inspect https://example.com/data.parquet
226
+
227
+ # Private S3 with profile
228
+ AWS_PROFILE=myprofile gpio inspect s3://private-bucket/data.parquet
229
+ ```
230
+
231
+ ## Convert to PMTiles (Vector Tiles)
232
+
233
+ Requires `gpio-pmtiles` plugin and `tippecanoe`.
234
+
235
+ ```bash
236
+ # If gpio installed via pipx
237
+ pipx inject geoparquet-io gpio-pmtiles
238
+
239
+ # Or with pip
240
+ pip install gpio-pmtiles
241
+
242
+ # Basic conversion
243
+ gpio pmtiles create input.parquet output.pmtiles
244
+
245
+ # With filtering (applied before tile generation)
246
+ gpio pmtiles create input.parquet output.pmtiles \
247
+ --where "population > 100000" \
248
+ --minzoom 0 --maxzoom 12
249
+
250
+ # Stream GeoJSON to tippecanoe (no intermediate files)
251
+ gpio convert geojson input.parquet - | \
252
+ tippecanoe -o output.pmtiles -zg --read-parallel
253
+
254
+ # With filtering and reduced precision for smaller output
255
+ gpio convert geojson input.parquet - --where "class = 'road'" | \
256
+ tippecanoe -o roads.pmtiles -zg -ps -pk --drop-densest-as-needed
257
+ ```
258
+
259
+ ## Common Options
260
+
261
+ - `--verbose`: Detailed progress output
262
+ - `--json`: Machine-readable output
263
+ - `--dry-run`: Preview operation without writing
264
+ - `--overwrite`: Replace output if it exists
@@ -0,0 +1,155 @@
1
+ # GeoParquet Tool Comparison
2
+
3
+ ## Feature Matrix
4
+
5
+ | Feature | gpio | GDAL/ogr2ogr | GeoPandas | DuckDB |
6
+ | ------------------------- | ------------- | ------------ | ----------- | --------- |
7
+ | GeoParquet read/write | Excellent | Good | Good | Good |
8
+ | Hilbert sorting | Yes (default) | No | No | Manual |
9
+ | Bbox column + covering | Yes | No | No | Manual |
10
+ | STAC generation | Yes | No | No | No |
11
+ | Cloud storage direct | Yes | Limited | Via fsspec | Yes |
12
+ | BigQuery extraction | Yes | No | No | No |
13
+ | ArcGIS Feature Service | Yes | No | No | No |
14
+ | PMTiles output | Yes (plugin) | No | No | No |
15
+ | Best practices by default | Yes | No | No | No |
16
+ | SQL queries | Basic | Limited | Python only | Excellent |
17
+
18
+ ## When to Use Each Tool
19
+
20
+ **Use gpio when:**
21
+
22
+ - Converting any geospatial format to GeoParquet
23
+ - You want best practices applied automatically
24
+ - Working with remote files/cloud storage
25
+ - Extracting from BigQuery or ArcGIS
26
+ - Publishing STAC metadata
27
+ - Creating PMTiles from GeoParquet
28
+
29
+ **Use DuckDB when:**
30
+
31
+ - Need complex SQL joins/aggregations
32
+ - Performing spatial analysis across multiple files
33
+ - Working interactively in notebooks
34
+ - Already have data in DuckDB tables
35
+ - Need custom transformations before final export
36
+
37
+ **Use GDAL/ogr2ogr when:**
38
+
39
+ - Converting obscure legacy formats
40
+ - Interfacing with PostGIS or databases
41
+ - Existing workflows already depend on GDAL
42
+
43
+ Then convert final output to optimized GeoParquet with gpio.
44
+
45
+ **Use GeoPandas when:**
46
+
47
+ - Interactive Python data exploration
48
+ - Data cleaning/transformation in pandas workflow
49
+ - Small to medium datasets that fit in memory
50
+
51
+ Then write final output with gpio for proper optimization.
52
+
53
+ ## Key Differences
54
+
55
+ ### gpio vs GDAL
56
+
57
+ GDAL can write Parquet/GeoParquet, but:
58
+
59
+ - Does not apply Hilbert sorting
60
+ - Does not add bbox covering metadata automatically
61
+ - No validation tools
62
+ - No STAC generation
63
+ - More complex CLI for common tasks
64
+
65
+ Example with GDAL:
66
+
67
+ ```bash
68
+ ogr2ogr -f Parquet output.parquet input.geojson
69
+ # Must manually sort, set compression, etc.
70
+ ```
71
+
72
+ With gpio:
73
+
74
+ ```bash
75
+ gpio convert geoparquet input.geojson output.parquet
76
+ # Best practices applied automatically
77
+ ```
78
+
79
+ ### gpio vs GeoPandas
80
+
81
+ GeoPandas writes GeoParquet via PyArrow, but:
82
+
83
+ - Loads entire dataset into memory
84
+ - No spatial sorting
85
+ - No optimization helpers
86
+ - No validation
87
+
88
+ Example with GeoPandas:
89
+
90
+ ```python
91
+ import geopandas as gpd
92
+
93
+ gdf = gpd.read_file("input.geojson")
94
+ gdf.to_parquet("output.parquet")
95
+ ```
96
+
97
+ Good for interactive work, not ideal for production/distribution.
98
+
99
+ ### gpio vs DuckDB
100
+
101
+ DuckDB is more flexible for SQL, but requires manual best practices:
102
+
103
+ ```sql
104
+ COPY (
105
+ SELECT
106
+ *,
107
+ ST_Extent(geometry) AS bbox
108
+ FROM my_table
109
+ ORDER BY ST_Hilbert(geometry)
110
+ ) TO 'output.parquet'
111
+ (FORMAT parquet, COMPRESSION zstd, COMPRESSION_LEVEL 15, ROW_GROUP_SIZE 100000);
112
+ ```
113
+
114
+ This works, but you still need:
115
+
116
+ - Manual bbox covering metadata
117
+ - Validation with gpio
118
+ - Separate STAC generation
119
+
120
+ Recommended pattern:
121
+
122
+ 1. Use DuckDB for transformations
123
+ 1. Export intermediate result
124
+ 1. Run `gpio add bbox` if needed
125
+ 1. Run `gpio check all`
126
+ 1. Run `gpio publish stac`
127
+
128
+ ## Installation
129
+
130
+ ### gpio
131
+
132
+ ```bash
133
+ # Isolated install (recommended)
134
+ pipx install --pre geoparquet-io
135
+
136
+ # Or with pip/uv
137
+ pip install --pre geoparquet-io
138
+ uv pip install --pre geoparquet-io
139
+ ```
140
+
141
+ ### DuckDB
142
+
143
+ ```bash
144
+ pip install "duckdb>=1.5"
145
+ ```
146
+
147
+ ### gpio-pmtiles plugin
148
+
149
+ ```bash
150
+ # If gpio installed via pipx
151
+ pipx inject geoparquet-io gpio-pmtiles
152
+
153
+ # Or with pip
154
+ pip install gpio-pmtiles
155
+ ```