Extract coordinate system metadata from CSLibrary XML files into CSV and JSON — parses projected and geographic coordinate systems, EPSG codes, datums, and units.
- Parses both ProjectedCoordinateSystem and GeographicCoordinateSystem elements
- Extracts: category, human-readable name, description, authority, EPSG code, units, datum ID, and additional parameter information
- Outputs to both CSV and JSON formats
- Handles the OGC/MapGuide coordinate system XML namespace
- Python 3.6+
- No third-party dependencies (uses only the Python standard library)
# Extract to both CSV and JSON (default) — outputs saved in the input folder
python cs_extract.py /path/to/CSLibrary
# Output to a different directory
python cs_extract.py /path/to/CSLibrary --output-dir /path/to/output
# CSV only
python cs_extract.py /path/to/CSLibrary --csv
# JSON only
python cs_extract.py /path/to/CSLibrary --jsonfolder Path to folder containing CSLibrary XML files
--output-dir DIR Directory for output files (default: same as input folder)
--csv Write CSV output only
--json Write JSON output only
If neither --csv nor --json is specified, both formats are written.
| Field | Description |
|---|---|
| CS_Category | ProjectedCoordinateSystem or GeographicCoordinateSystem |
| Human_Readable_Name | Display name of the coordinate system |
| Description | Detailed description text |
| Authority | Authority reference string |
| EPSG_Code | EPSG identifier (if present in authority text) |
| Units | Unit of measure from the Axis element |
| DatumId | Associated datum identifier |
| AdditionalInformation | Key-value parameter pairs (JSON-serialized in CSV) |
CS_Extract/
├── cs_extract.py # Main script
├── .gitignore
├── .gitattributes
├── LICENSE # GPL-3.0
└── README.md
GPL-3.0 — see LICENSE.