-
Notifications
You must be signed in to change notification settings - Fork 0
Output Reference
CS Extract produces two output files: a flat CSV and a nested JSON document. Both contain the same data, differing only in how the AdditionalInformation field is represented.
| File | Format | Encoding |
|---|---|---|
coordinate_systems_extended.csv |
RFC 4180 CSV with header row | UTF-8 |
coordinate_systems_extended.json |
JSON array of objects | UTF-8, 2-space indent |
Each record corresponds to one ProjectedCoordinateSystem or GeographicCoordinateSystem element found in the source XML.
| # | Field | CSV Column | JSON Key | Type | Description |
|---|---|---|---|---|---|
| 1 | CS_Category | CS_Category |
CS_Category |
string | The coordinate system type. One of: ProjectedCoordinateSystem or GeographicCoordinateSystem. |
| 2 | Human_Readable_Name | Human_Readable_Name |
Human_Readable_Name |
string | The display name from the <Name> element (e.g., "NAD83 / UTM zone 18N"). Empty string if absent. |
| 3 | Description | Description |
Description |
string | Full description text from the <Description> element. Empty string if absent. |
| 4 | Authority | Authority |
Authority |
string | The raw authority reference string from the <Authority> element (e.g., "EPSG:26918 OGP"). Empty string if absent. |
| 5 | EPSG_Code | EPSG_Code |
EPSG_Code |
string | The EPSG identifier extracted from the Authority text. Parsed by finding the first whitespace-delimited token starting with EPSG: (e.g., "EPSG:26918"). Empty string if no EPSG token is found. |
| 6 | Units | Units |
Units |
string | Unit of measure from the uom attribute of the <Axis> element (e.g., "METER", "DEGREE"). Empty string if the element or attribute is absent. |
| 7 | DatumId | DatumId |
DatumId |
string | The datum identifier from the <DatumId> element (e.g., "NAD83"). Empty string if absent. |
| 8 | AdditionalInformation | AdditionalInformation |
AdditionalInformation |
see below | Key-value pairs from <AdditionalInformation>/<ParameterItem> elements. |
The AdditionalInformation field collects all <ParameterItem> children found under the <AdditionalInformation> element of each coordinate system. Each item has a <Key> and either an <IntegerValue> or <Value> child.
| Format | Representation | Example |
|---|---|---|
| CSV | JSON-serialized string (escaped and quoted within the CSV cell) | "{""EPSG Code"": ""26918"", ""Projection"": ""Transverse Mercator""}" |
| JSON | Native JSON object (nested dictionary) | {"EPSG Code": "26918", "Projection": "Transverse Mercator"} |
When consuming the CSV in Python:
import csv, json
with open("coordinate_systems_extended.csv", encoding="utf-8") as f:
reader = csv.DictReader(f)
for row in reader:
extra = json.loads(row["AdditionalInformation"])
print(extra) # dict of key-value pairsCS_Category,Human_Readable_Name,Description,Authority,EPSG_Code,Units,DatumId,AdditionalInformation
ProjectedCoordinateSystem,NAD83 / UTM zone 18N,UTM zone 18N based on NAD83,EPSG:26918 OGP,EPSG:26918,METER,NAD83,"{""EPSG Code"": ""26918""}"
{
"CS_Category": "ProjectedCoordinateSystem",
"Human_Readable_Name": "NAD83 / UTM zone 18N",
"Description": "UTM zone 18N based on NAD83",
"Authority": "EPSG:26918 OGP",
"EPSG_Code": "EPSG:26918",
"Units": "METER",
"DatumId": "NAD83",
"AdditionalInformation": {
"EPSG Code": "26918"
}
}Q: Why is AdditionalInformation a JSON string in CSV but a dict in JSON? A: CSV is a flat format with no native support for nested structures. The tool serializes the dictionary to a JSON string so the CSV remains a single flat table. The JSON output keeps the native nested form.
Q: Are field names stable across runs?
A: Yes. The eight field names listed above are hard-coded in the script and will not change between runs. The keys inside AdditionalInformation depend on what the source XML contains and may vary across coordinate systems.
Q: What happens if an XML element is missing?
A: The corresponding field is set to an empty string ("" in CSV, "" in JSON). For AdditionalInformation, a missing or empty section produces an empty object ({} in JSON, "{}" in CSV).