File Format - CSV
File Format - CSV
Purpose
CSV files provide comma-delimited point data for HAPI import and export workflows. HAPI supports ordinary mapped CSV files and a strict ECM-ready CSV mode.
General Architecture
CSV is not fixed-width. It must be parsed as a proper CSV file rather than by simple comma splitting, because Style Code fields may contain internal commas inside quoted strings, such as tree measurement strings.
Operating Modes
| Mode | Trigger | Behaviour |
|---|---|---|
| Standard Mode | User selects a mapping pattern such as PNEZD or PENZ. | Uses dynamic column mapping. |
| ECM Ready Mode | User explicitly selects ECM Ready. | Uses strict seven-column extraction. |
Standard CSV Data Keys
| Key | Field | Notes |
|---|---|---|
P | Point Number | Used for downstream feature grouping. |
N | Northing | Y-coordinate. |
E | Easting | X-coordinate. |
Z | Reduced Level | If absent in a 2D mapping, Z should be treated as 0.000. |
D / C | Point Code / Description | Stores the raw Point Code / description string. |
Rotation Handling
Standard survey CSV files do not normally include rotation data. Rotation should therefore be treated as zero unless supplied by ECM-ready mode or another explicit source.
ECM-ready CSV
For ECM-ready CSV details, use ECM_Ready_CSV_File_Format.
Edge Cases
| Edge Case | Required Treatment |
|---|---|
| Header row | Detect and skip text headers before processing data rows. |
| Quoted Style Code containing commas | Preserve the quoted string as one field. |
| Mismatched mapping and column count | Treat as invalid input rather than guessing missing columns. |
| Blank Style Code in ECM-ready mode | Do not append a trailing space to the Raw Description. |
Related Scripts
Source Basis
HAPI User Manual.pdf, Sections 2.3.1, 2.3.4, and 4.2.File Format - CSV File.md.