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,125 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gdal
|
|
3
|
+
description: This skill should be used when working with GDAL command line tools for raster and vector geospatial processing. Covers inspection, reprojection, clipping, raster conversion, mosaics, tiling, rasterization, and COG creation.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# GDAL Skill
|
|
7
|
+
|
|
8
|
+
Use GDAL command line tools for common raster and vector geospatial workflows.
|
|
9
|
+
|
|
10
|
+
## Tools
|
|
11
|
+
|
|
12
|
+
Prefer the smallest tool that fits the task:
|
|
13
|
+
|
|
14
|
+
- `gdalinfo`
|
|
15
|
+
- `ogrinfo`
|
|
16
|
+
- `gdalwarp`
|
|
17
|
+
- `gdal_translate`
|
|
18
|
+
- `gdalbuildvrt`
|
|
19
|
+
- `gdaladdo`
|
|
20
|
+
- `gdaltindex`
|
|
21
|
+
- `gdal_rasterize`
|
|
22
|
+
- `gdal2tiles.py`
|
|
23
|
+
- `ogr2ogr`
|
|
24
|
+
|
|
25
|
+
If GDAL is not installed, ask the user to install it before continuing.
|
|
26
|
+
|
|
27
|
+
## Workflow
|
|
28
|
+
|
|
29
|
+
### 1. Inspect first
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
gdalinfo INPUT.tif
|
|
33
|
+
ogrinfo INPUT.shp -so -al
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
One full `gdalinfo` dump on unknown data is worth it; after that, grep for the lines you need (`Size is|Origin|Pixel Size|Band|Overviews|ID\[`) — full WKT dumps are large. For vectors, `-so -al` prints the layer summary; bare `-so` without `-al` or a layer name prints nothing useful.
|
|
37
|
+
|
|
38
|
+
### 2. Pick raster vs vector path
|
|
39
|
+
|
|
40
|
+
- Raster tasks: `gdalwarp`, `gdal_translate`, `gdalbuildvrt`, `gdal_rasterize`, `gdal2tiles.py`
|
|
41
|
+
- Vector tasks: `ogr2ogr`, `ogrinfo`, `gdaltindex`
|
|
42
|
+
|
|
43
|
+
### 3. Write a new output
|
|
44
|
+
|
|
45
|
+
- prefer new output files
|
|
46
|
+
- preserve CRS and nodata intentionally
|
|
47
|
+
- use compression for large rasters
|
|
48
|
+
|
|
49
|
+
### 4. Validate output
|
|
50
|
+
|
|
51
|
+
Use the check that matches the operation — improvising verification is where runs go wrong:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Any lossless conversion or mosaic: band checksums must match the input
|
|
55
|
+
gdalinfo -checksum INPUT.tif | grep Checksum
|
|
56
|
+
gdalinfo -checksum OUTPUT.tif | grep Checksum
|
|
57
|
+
|
|
58
|
+
# COG: quick layout check, then real validation
|
|
59
|
+
gdalinfo OUTPUT.tif | grep -E "LAYOUT|Block=|Overviews"
|
|
60
|
+
rio cogeo validate OUTPUT.tif # via `uv run --with rio-cogeo` if not installed
|
|
61
|
+
|
|
62
|
+
# Warp/clip: CRS, resolution, per-band min/max in one call
|
|
63
|
+
gdalinfo -mm OUTPUT.tif
|
|
64
|
+
|
|
65
|
+
# Mosaic seamlessness: each quadrant bit-identical to its source tile
|
|
66
|
+
# (explicit offsets per tile — avoid shell arrays, the login shell may be zsh)
|
|
67
|
+
gdal_translate -q -of VRT -srcwin 0 0 256 256 MOSAIC.tif /tmp/quad.vrt
|
|
68
|
+
gdalinfo -checksum /tmp/quad.vrt | grep Checksum # compare vs TILE_0.tif
|
|
69
|
+
|
|
70
|
+
# Vector: layer summary + SQLite-dialect counts
|
|
71
|
+
ogrinfo OUTPUT.gpkg LAYER -so
|
|
72
|
+
ogrinfo OUTPUT.gpkg -dialect SQLite -sql "SELECT COUNT(*) FROM layer"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`gdaladdo` on a writable GeoTIFF builds internal overviews; `-ro` forces an external `.ovr` sidecar — so the absence of a `.ovr` file next to the output proves the overviews are internal.
|
|
76
|
+
|
|
77
|
+
## Quick Reference
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Inspect
|
|
81
|
+
gdalinfo INPUT.tif
|
|
82
|
+
ogrinfo INPUT.shp -so
|
|
83
|
+
|
|
84
|
+
# Vector conversion and clipping
|
|
85
|
+
ogr2ogr -f GeoJSON -t_srs epsg:4326 OUTPUT.geojson INPUT.shp
|
|
86
|
+
gdaltindex -t_srs epsg:4326 -f GeoJSON OUTPUT_EXTENT.geojson INPUT_RASTER.tif
|
|
87
|
+
ogr2ogr -f GeoJSON -clipsrc OUTPUT_EXTENT.geojson OUTPUT_CLIPPED.geojson INPUT.shp
|
|
88
|
+
|
|
89
|
+
# Raster reprojection (choose -r intentionally: bilinear/cubic for continuous, near for categorical)
|
|
90
|
+
gdalwarp -t_srs EPSG:XXXX -tr XRES YRES -r bilinear -co TILED=YES -co COMPRESS=DEFLATE -co PREDICTOR=2 INPUT.tif OUTPUT.tif
|
|
91
|
+
|
|
92
|
+
# Raster clipping
|
|
93
|
+
gdal_translate -srcwin XOFF YOFF XSIZE YSIZE INPUT.tif OUTPUT.tif # by pixel window (exact, no resampling)
|
|
94
|
+
gdal_translate -projwin ULX ULY LRX LRY INPUT.tif OUTPUT.tif # by georeferenced bounds
|
|
95
|
+
gdalwarp -cutline INPUT.shp -crop_to_cutline -dstalpha INPUT.tif OUTPUT.tif # by polygon
|
|
96
|
+
|
|
97
|
+
# Raster conversion
|
|
98
|
+
gdal_translate -b 1 -b 2 -b 3 INPUT.tif OUTPUT.tif
|
|
99
|
+
gdal_translate -b 1 -b 2 -b 3 -of JPEG -outsize 400 0 INPUT.tif OUTPUT.jpg
|
|
100
|
+
|
|
101
|
+
# Mosaic and stack
|
|
102
|
+
gdalbuildvrt OUTPUT.vrt path/to/tiffs/*.tif
|
|
103
|
+
gdal_translate -co TILED=YES -co BIGTIFF=YES -co NUM_THREADS=ALL_CPUS -co COMPRESS=LZW -co PREDICTOR=2 OUTPUT.vrt OUTPUT.tif
|
|
104
|
+
|
|
105
|
+
# Internal overviews on an existing GeoTIFF (-r near for categorical; -ro writes external .ovr instead)
|
|
106
|
+
gdaladdo -r average OUTPUT.tif 2 4 8
|
|
107
|
+
|
|
108
|
+
# Rasterize and tile
|
|
109
|
+
gdal_rasterize -burn 1.0 -ot Byte -of GTiff -co COMPRESS=LZW -co BIGTIFF=YES INPUT.shp OUTPUT.tif
|
|
110
|
+
gdal2tiles.py -z 10-16 INPUT_BYTE.tif OUTPUT/
|
|
111
|
+
|
|
112
|
+
# COG (format-only conversion — smallest tool that fits)
|
|
113
|
+
gdal_translate -of COG -co COMPRESS=LZW -co PREDICTOR=2 -co NUM_THREADS=ALL_CPUS INPUT.tif OUTPUT.tif
|
|
114
|
+
# use gdalwarp -of COG only when also reprojecting in the same step
|
|
115
|
+
|
|
116
|
+
# Vector SQL: OGR's default dialect has no GROUP BY, window, or spatial functions —
|
|
117
|
+
# pass -dialect SQLite for anything beyond simple SELECT/WHERE
|
|
118
|
+
ogr2ogr -f GPKG OUT.gpkg IN.shp -dialect SQLite \
|
|
119
|
+
-sql "SELECT *, ST_Area(ST_Transform(geometry, EPSG)) AS area_m2 FROM layer WHERE landuse IN ('ag')" \
|
|
120
|
+
-t_srs EPSG:XXXX -nln layername
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## References
|
|
124
|
+
|
|
125
|
+
- `references/gdal-recipes.md` (the only reference file)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Upstream Attribution
|
|
2
|
+
|
|
3
|
+
This skill is derived from the `gdal` skill in `isaaccorley/geospatial-skills`.
|
|
4
|
+
|
|
5
|
+
- **Upstream repository:** https://github.com/isaaccorley/geospatial-skills
|
|
6
|
+
- **Upstream path:** `skills/gdal/`
|
|
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/gdal/`
|
|
11
|
+
|
|
12
|
+
## Imported Files
|
|
13
|
+
|
|
14
|
+
- `SKILL.md`
|
|
15
|
+
- `references/gdal-recipes.md`
|
|
16
|
+
|
|
17
|
+
## Local modifications
|
|
18
|
+
|
|
19
|
+
Initial import:
|
|
20
|
+
- Local behavioral modifications: none (faithful vendoring, byte-for-byte identical to upstream).
|
|
21
|
+
|
|
22
|
+
Any future AgentLayer modifications must be documented here.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# GDAL Recipes
|
|
2
|
+
|
|
3
|
+
General GDAL command patterns for raster and vector processing.
|
|
4
|
+
|
|
5
|
+
## Vector recipes
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Create polygon of raster extent
|
|
9
|
+
gdaltindex -t_srs epsg:4326 -f GeoJSON OUTPUT_EXTENT.geojson INPUT_RASTER.tif
|
|
10
|
+
|
|
11
|
+
# Clip shapefile to raster extent
|
|
12
|
+
gdaltindex -t_srs epsg:4326 -f GeoJSON OUTPUT_EXTENT.geojson INPUT_RASTER.tif
|
|
13
|
+
ogr2ogr -f GeoJSON -clipsrc OUTPUT_EXTENT.geojson OUTPUT_CLIPPED.geojson INPUT.shp
|
|
14
|
+
|
|
15
|
+
# Convert shapefile to GeoJSON
|
|
16
|
+
ogr2ogr -f GeoJSON -t_srs epsg:4326 OUTPUT.geojson INPUT.shp
|
|
17
|
+
|
|
18
|
+
# Reproject vector file
|
|
19
|
+
ogr2ogr -f GeoJSON -t_srs epsg:4326 OUTPUT.geojson INPUT.shp
|
|
20
|
+
|
|
21
|
+
# Filter + computed fields need -dialect SQLite (OGR's default dialect
|
|
22
|
+
# has no GROUP BY, window functions, or spatial functions)
|
|
23
|
+
ogr2ogr -f GPKG OUT.gpkg IN.shp -dialect SQLite \
|
|
24
|
+
-sql "SELECT *, ST_Area(ST_Transform(geometry, EPSG)) AS area_m2 FROM layer WHERE field IN ('a','b')" \
|
|
25
|
+
-t_srs EPSG:XXXX -nln layername
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Raster recipes
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Reproject raster (set resolution and resampling explicitly:
|
|
32
|
+
# bilinear/cubic for continuous data, near for categorical)
|
|
33
|
+
gdalwarp -t_srs EPSG:XXXX -tr XRES YRES -r bilinear -co TILED=YES -co COMPRESS=DEFLATE -co PREDICTOR=2 INPUT.tif OUTPUT.tif
|
|
34
|
+
|
|
35
|
+
# Clip by pixel window (exact, no resampling)
|
|
36
|
+
gdal_translate -srcwin XOFF YOFF XSIZE YSIZE INPUT.tif OUTPUT.tif
|
|
37
|
+
|
|
38
|
+
# Clip by georeferenced bounds
|
|
39
|
+
gdal_translate -projwin ULX ULY LRX LRY INPUT.tif OUTPUT.tif
|
|
40
|
+
|
|
41
|
+
# Crop raster based on a shapefile
|
|
42
|
+
gdalwarp -cutline INPUT.shp -crop_to_cutline -dstalpha INPUT.tif OUTPUT.tif
|
|
43
|
+
|
|
44
|
+
# Extract subset of bands
|
|
45
|
+
gdal_translate -b 1 -b 2 -b 3 INPUT.tif OUTPUT.tif
|
|
46
|
+
|
|
47
|
+
# Make thumbnail
|
|
48
|
+
gdal_translate -b 1 -b 2 -b 3 -of JPEG -outsize 400 0 INPUT.tif OUTPUT.jpg
|
|
49
|
+
|
|
50
|
+
# Quantize float raster to byte
|
|
51
|
+
gdal_translate -of GTiff -ot Byte -scale 0 4000 0 255 -co COMPRESS=LZW -co BIGTIFF=YES INPUT.tif OUTPUT.tif
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Mosaics and band stacks
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Merge many rasters into a VRT
|
|
58
|
+
gdalbuildvrt OUTPUT.vrt path/to/tiffs/*.tif
|
|
59
|
+
|
|
60
|
+
# Build VRT from list of files
|
|
61
|
+
gdalbuildvrt OUTPUT.vrt -input_file_list INPUT_FILES.txt
|
|
62
|
+
|
|
63
|
+
# Convert VRT to compressed GeoTIFF
|
|
64
|
+
gdal_translate -co BIGTIFF=YES -co NUM_THREADS=ALL_CPUS -co COMPRESS=LZW -co PREDICTOR=2 OUTPUT.vrt OUTPUT.tif
|
|
65
|
+
|
|
66
|
+
# Stack aligned bands
|
|
67
|
+
gdalbuildvrt -separate OUTPUT.vrt BAND_1.tif BAND_2.tif BAND_3.tif
|
|
68
|
+
gdal_translate OUTPUT.vrt OUTPUT.tif
|
|
69
|
+
|
|
70
|
+
# Internal overviews (-r near for categorical; -ro would write an external .ovr)
|
|
71
|
+
gdaladdo -r average OUTPUT.tif 2 4 8
|
|
72
|
+
|
|
73
|
+
# Verify a mosaic quadrant is bit-identical to its source tile (repeat per tile;
|
|
74
|
+
# explicit offsets — avoid shell arrays, the login shell may be zsh)
|
|
75
|
+
gdal_translate -q -of VRT -srcwin 0 0 256 256 MOSAIC.tif /tmp/quad.vrt
|
|
76
|
+
gdalinfo -checksum /tmp/quad.vrt | grep Checksum # compare vs TILE_0.tif
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Rasterization and tiles
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Rasterize vector file
|
|
83
|
+
gdal_rasterize -burn 1.0 -ot Byte -of GTiff -co COMPRESS=LZW -co BIGTIFF=YES INPUT.shp OUTPUT.tif
|
|
84
|
+
|
|
85
|
+
# Rasterize using an attribute field
|
|
86
|
+
gdal_rasterize -a label -a_nodata 0 -ot Byte -tr 0.000269494585236 0.000269494585236 -co COMPRESS=LZW INPUT.shp OUTPUT.tif
|
|
87
|
+
|
|
88
|
+
# Convert raster to XYZ tiles
|
|
89
|
+
gdal2tiles.py -z 10-16 INPUT_BYTE.tif OUTPUT/
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## COG
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Format-only conversion — smallest tool that fits
|
|
96
|
+
gdal_translate -of COG -co COMPRESS=LZW -co PREDICTOR=2 -co NUM_THREADS=ALL_CPUS INPUT.tif OUTPUT.tif
|
|
97
|
+
|
|
98
|
+
# Only when also reprojecting in the same step
|
|
99
|
+
gdalwarp -t_srs EPSG:XXXX -of COG -co BIGTIFF=YES -co NUM_THREADS=ALL_CPUS -co COMPRESS=LZW -co PREDICTOR=2 INPUT.tif OUTPUT.tif
|
|
100
|
+
|
|
101
|
+
# Validate
|
|
102
|
+
rio cogeo validate OUTPUT.tif # via `uv run --with rio-cogeo` if not installed
|
|
103
|
+
```
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gdal",
|
|
3
|
+
"layer": "domain",
|
|
4
|
+
"domains": [
|
|
5
|
+
"geospatial"
|
|
6
|
+
],
|
|
7
|
+
"capabilities": [
|
|
8
|
+
"raster-processing",
|
|
9
|
+
"reprojection",
|
|
10
|
+
"cog-conversion",
|
|
11
|
+
"ogr2ogr",
|
|
12
|
+
"raster-clipping"
|
|
13
|
+
],
|
|
14
|
+
"triggers": [
|
|
15
|
+
"gdal",
|
|
16
|
+
"ogr",
|
|
17
|
+
"geotiff",
|
|
18
|
+
"cog",
|
|
19
|
+
"cloud-optimized geotiff",
|
|
20
|
+
"reproject",
|
|
21
|
+
"gdalwarp",
|
|
22
|
+
"gdal_translate",
|
|
23
|
+
"raster clip",
|
|
24
|
+
"raster mosaic"
|
|
25
|
+
],
|
|
26
|
+
"recommended": [
|
|
27
|
+
"verification"
|
|
28
|
+
],
|
|
29
|
+
"requires": [],
|
|
30
|
+
"conflicts": [],
|
|
31
|
+
"explanation": "Executes GDAL/OGR CLI operations for raster reprojection, clipping, and COG conversion.",
|
|
32
|
+
"sections": [
|
|
33
|
+
{
|
|
34
|
+
"id": "tools",
|
|
35
|
+
"title": "Tools",
|
|
36
|
+
"source": "SKILL.md#tools"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": "workflow",
|
|
40
|
+
"title": "Workflow",
|
|
41
|
+
"source": "SKILL.md#workflow"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"id": "quick-reference",
|
|
45
|
+
"title": "Quick Reference",
|
|
46
|
+
"source": "SKILL.md#quick-reference"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"id": "references",
|
|
50
|
+
"title": "References",
|
|
51
|
+
"source": "SKILL.md#references"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"id": "gdal-recipes",
|
|
55
|
+
"title": "GDAL Recipes",
|
|
56
|
+
"source": "references/gdal-recipes.md"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"checks": [
|
|
60
|
+
"crs.defined",
|
|
61
|
+
"crs.consistent",
|
|
62
|
+
"raster.nodata_declared",
|
|
63
|
+
"raster.resampling",
|
|
64
|
+
"raster.cog_layout"
|
|
65
|
+
]
|
|
66
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# GeoMaster Geospatial Science Skill
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
GeoMaster is a comprehensive geospatial science skill covering:
|
|
6
|
+
- **70+ sections** on geospatial science topics
|
|
7
|
+
- **500+ code examples** across 7 programming languages
|
|
8
|
+
- **300+ geospatial libraries** and tools
|
|
9
|
+
- Remote sensing, GIS, spatial statistics, ML/AI for Earth observation
|
|
10
|
+
|
|
11
|
+
## Contents
|
|
12
|
+
|
|
13
|
+
### Main Documentation
|
|
14
|
+
- **SKILL.md** - Main skill documentation with installation, quick start, core concepts, common operations, and workflows
|
|
15
|
+
|
|
16
|
+
### Reference Documentation
|
|
17
|
+
1. **core-libraries.md** - GDAL, Rasterio, Fiona, Shapely, PyProj, GeoPandas
|
|
18
|
+
2. **remote-sensing.md** - Satellite missions, optical/SAR/hyperspectral analysis, image processing
|
|
19
|
+
3. **gis-software.md** - QGIS/PyQGIS, ArcGIS/ArcPy, GRASS GIS, SAGA GIS integration
|
|
20
|
+
4. **scientific-domains.md** - Marine, atmospheric, hydrology, agriculture, forestry applications
|
|
21
|
+
5. **advanced-gis.md** - 3D GIS, spatiotemporal analysis, topology, network analysis
|
|
22
|
+
6. **programming-languages.md** - R, Julia, JavaScript, C++, Java, Go geospatial tools
|
|
23
|
+
7. **machine-learning.md** - Deep learning for RS, spatial ML, GNNs, XAI for geospatial
|
|
24
|
+
8. **big-data.md** - Distributed processing, cloud platforms, GPU acceleration
|
|
25
|
+
9. **industry-applications.md** - Urban planning, disaster management, utilities, transportation
|
|
26
|
+
10. **specialized-topics.md** - Geostatistics, optimization, ethics, best practices
|
|
27
|
+
11. **data-sources.md** - Satellite data catalogs, open data repositories, API access
|
|
28
|
+
12. **code-examples.md** - 500+ code examples across 7 programming languages
|
|
29
|
+
|
|
30
|
+
## Key Topics Covered
|
|
31
|
+
|
|
32
|
+
### Remote Sensing
|
|
33
|
+
- Sentinel-1/2/3, Landsat, MODIS, Planet, Maxar
|
|
34
|
+
- SAR, hyperspectral, LiDAR, thermal imaging
|
|
35
|
+
- Spectral indices, classification, change detection
|
|
36
|
+
|
|
37
|
+
### GIS Operations
|
|
38
|
+
- Vector data (points, lines, polygons)
|
|
39
|
+
- Raster data processing
|
|
40
|
+
- Coordinate reference systems
|
|
41
|
+
- Spatial analysis and statistics
|
|
42
|
+
|
|
43
|
+
### Machine Learning
|
|
44
|
+
- Random Forest, SVM, CNN, U-Net
|
|
45
|
+
- Spatial statistics, geostatistics
|
|
46
|
+
- Graph neural networks
|
|
47
|
+
- Explainable AI
|
|
48
|
+
|
|
49
|
+
### Programming Languages
|
|
50
|
+
- **Python** - GDAL, Rasterio, GeoPandas, TorchGeo, RSGISLib
|
|
51
|
+
- **R** - sf, terra, raster, stars
|
|
52
|
+
- **Julia** - ArchGDAL, GeoStats.jl
|
|
53
|
+
- **JavaScript** - Turf.js, Leaflet
|
|
54
|
+
- **C++** - GDAL C++ API
|
|
55
|
+
- **Java** - GeoTools
|
|
56
|
+
- **Go** - Simple Features Go
|
|
57
|
+
|
|
58
|
+
## Installation
|
|
59
|
+
|
|
60
|
+
See [SKILL.md](SKILL.md) for detailed installation instructions.
|
|
61
|
+
|
|
62
|
+
### Core Python Stack
|
|
63
|
+
```bash
|
|
64
|
+
conda install -c conda-forge gdal rasterio fiona shapely pyproj geopandas
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Remote Sensing
|
|
68
|
+
```bash
|
|
69
|
+
uv pip install rsgislib torchgeo earthengine-api
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Quick Examples
|
|
73
|
+
|
|
74
|
+
### Calculate NDVI from Sentinel-2
|
|
75
|
+
```python
|
|
76
|
+
import rasterio
|
|
77
|
+
import numpy as np
|
|
78
|
+
|
|
79
|
+
with rasterio.open('sentinel2.tif') as src:
|
|
80
|
+
red = src.read(4)
|
|
81
|
+
nir = src.read(8)
|
|
82
|
+
ndvi = (nir - red) / (nir + red + 1e-8)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Spatial Analysis with GeoPandas
|
|
86
|
+
```python
|
|
87
|
+
import geopandas as gpd
|
|
88
|
+
|
|
89
|
+
zones = gpd.read_file('zones.geojson')
|
|
90
|
+
points = gpd.read_file('points.geojson')
|
|
91
|
+
joined = gpd.sjoin(points, zones, predicate='within')
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
MIT License
|
|
97
|
+
|
|
98
|
+
## Author
|
|
99
|
+
|
|
100
|
+
K-Dense Inc.
|
|
101
|
+
|
|
102
|
+
## Contributing
|
|
103
|
+
|
|
104
|
+
This skill is part of the K-Dense-AI/scientific-agent-skills repository.
|
|
105
|
+
For contributions, see the main repository guidelines.
|