Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

GDAL ogr2ogr

$ ogr2ogr Foundation Med Risk
OSGeo · Database & Data · MIT · macos / linux / windows

ogr2ogr (paired with ogrinfo) is OSGeo's industry-standard geospatial vector ETL CLI. It converts and reprojects between 80+ vector formats—including GeoJSON, GeoParquet (-f Parquet), Shapefile, GeoPackage, and PostGIS—with OGR SQL attribute/spatial filtering.

FCRS-1.0 Score
81 /100
Good
Medium Confidence
Zero-Friction Install
brew install gdal
CLI vs MCP Decision CLI Only

Performs exact coordinate reprojections (-t_srs) and GeoParquet/GeoJSON/Shapefile conversions locally using GDAL/PROJ without custom Python geopandas scripts.

Agent-Readiness Checklist

— JSON Output
✓ Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 19 / 25

Non-interactive and supports /vsistdout/ plus ogrinfo -json, though destination-before-source argument order and C++ driver flags require care.

  • Supports -sql, /vsistdout/, and companion ogrinfo -json
  • Non-standard dst src argument order
Trust & Safety 21 / 25

Explicit destination file or PostGIS DSN required; -overwrite and -update can replace existing layers if specified.

  • Destination-first syntax; -overwrite poses table replacement risk
Setup & Portability 10 / 15

Heavyweight C++ suite (gdal, proj, geos, arrow) via Homebrew/conda/apt; driver availability (Parquet) depends on build flags.

  • Large native dependency tree; driver support varies by build
Utility & Efficiency 15 / 15

Unmatched 80+ geospatial vector format support, spatial clipping (-clipsrc), and CRS reprojection (-t_srs).

  • Canonical geospatial ETL across GeoJSON, GeoParquet, Shapefile, PostGIS
Maintenance & Lineage 9 / 10

Flagship OSGeo foundation project (OSGeo/gdal) under MIT license.

  • Official OSGeo OSGeo/gdal repository
Docs & Verifiability 7 / 10

Extensive gdal.org manual, though driver-specific -lco/-dsco options span dozens of pages.

  • Comprehensive docs at gdal.org/en/stable/programs/ogr2ogr.html

Security, Auth & Guardrails

Auth Modes
No Auth Env API Key Config File
Credential Storage

None for local files; PostGIS or cloud /vsis3/ drivers read standard libpq (PGPASSWORD, ~/.pgpass) or AWS env credentials.

Side Effects
Read-Only Local Write Remote Write
Cost & Quotas

MIT open-source OSGeo suite; completely free.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# GDAL ogr2ogr Agent Rules
- Note argument order: `ogr2ogr [opts] <dst_dataset> <src_dataset>` (destination comes FIRST!).
- Inspect metadata first with `ogrinfo -json -so <file>` before converting.
- Avoid `-overwrite` on existing PostGIS tables or GeoPackages without explicit user approval.

Agent-Ready Command Recipes

Safe Read-Only Queries

Inspect vector layers and schema in JSON
ogrinfo -json -so input.parquet

Uses companion ogrinfo -json -so (summary only) to inspect CRS, geometry type, and attribute schema.

Filter a GeoParquet file and stream GeoJSON to stdout
ogr2ogr -f GeoJSON /vsistdout/ input.parquet -sql "SELECT name, geom FROM input LIMIT 20"

Queries attributes with -sql and streams GeoJSON directly to /vsistdout/ without writing a file.

Controlled Writes & Previews

Convert GeoJSON to GeoParquet with CRS reprojection
ogr2ogr -f Parquet -t_srs EPSG:4326 out.parquet in.geojson

Reprojects vector features to WGS84 and writes an Apache GeoParquet file (out.parquet).

Strengths for Agents

  • + Supports 80+ geospatial formats including GeoJSON, GeoParquet, Shapefile, FlatGeobuf, and PostGIS.
  • + Companion ogrinfo -json -so gives agents clean JSON schema & CRS summaries.
  • + Accurate coordinate transforms via PROJ (-s_srs / -t_srs).

Caveats & Pitfalls

  • ! Destination comes before source (ogr2ogr dst src)—reversing them can overwrite the input file!
  • ! GeoParquet (-f Parquet) requires a GDAL build compiled with Apache Arrow/Parquet support (ogr2ogr --formats to check).

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI