-
Notifications
You must be signed in to change notification settings - Fork 0
Usage
ixhlbxi edited this page Apr 13, 2026
·
1 revision
CS Extract is a single-file CLI tool. All options are passed as command-line arguments to cs_extract.py.
python cs_extract.py <folder> [--output-dir DIR] [--csv] [--json]| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
folder |
Positional | Yes | -- | Path to the folder containing CSLibrary XML files. Every .xml file in this directory will be parsed. |
--output-dir |
Option | No | Same as folder
|
Directory where output files are written. Must already exist. |
--csv |
Flag | No | Off | Write CSV output only. |
--json |
Flag | No | Off | Write JSON output only. |
- If neither
--csvnor--jsonis specified, both formats are written. - If one flag is specified, only that format is written.
- If both flags are specified, both formats are written (same as the default).
| Flag | Output filename | Location |
|---|---|---|
--csv |
coordinate_systems_extended.csv |
--output-dir (or input folder) |
--json |
coordinate_systems_extended.json |
--output-dir (or input folder) |
python cs_extract.py /path/to/CSLibraryOutput:
Processing /path/to/CSLibrary/projected.xml...
Processing /path/to/CSLibrary/geographic.xml...
CSV output saved to: /path/to/CSLibrary/coordinate_systems_extended.csv
JSON output saved to: /path/to/CSLibrary/coordinate_systems_extended.json
Extraction complete.
python cs_extract.py /path/to/CSLibrary --csv --output-dir /path/to/outputpython cs_extract.py /path/to/CSLibrary --jsonpython cs_extract.py "C:\Program Files\Autodesk\CSLibrary" --output-dir "D:\GIS\Output"| Condition | Behavior |
|---|---|
folder does not exist |
Prints Error: folder not found: <path> and exits with code 1. |
--output-dir does not exist |
Prints Error: output directory not found: <path> and exits with code 1. |
| Malformed XML file | Prints Error processing <path>: <details> and continues to the next file. |
| No XML files found | Completes with zero records; output files are created but empty (CSV has only a header row, JSON contains []). |
Q: Does it recurse into subdirectories?
A: No. Only .xml files directly inside the specified folder are processed. Subdirectories are ignored.
Q: What XML namespace does it expect?
A: http://www.osgeo.org/mapguide/coordinatesystem. Files using a different namespace will yield zero records (no error).
Q: Can I pipe the output to stdout instead of a file? A: Not currently. The tool always writes to disk. You can read the resulting file immediately after the run completes.
Q: What Python version is required? A: Python 3.6 or later. No third-party packages are needed.