Preserve Checkpoint IDs in CSV: A GDAL CSVT Import Tutorial
Keep leading-zero checkpoint identifiers as text, declare CSV column types with a CSVT companion, and verify survey-table imports before matching records.

Treat the checkpoint identifier as part of the evidence
A checkpoint table can remain readable after import while its identifiers have changed. A label such as 0007 may become 7 if a receiving application interprets it as a number. In a NiVO survey assessment, that can break links among surveyed targets, image observations and comparison records. This tutorial defines explicit field types for a CSV table using the GDAL CSVT companion convention. It addresses import integrity only. It does not collect checkpoints, establish their independence, calculate survey accuracy or claim that an actual NiVO project experienced this problem.
Begin with the accepted original table and record its revision, column order, delimiter, encoding and identifier policy. Decide whether leading zeros, letter case and punctuation are meaningful parts of the key. Link the table to the relevant project and point register before loading it into another tool. Keep the master unchanged while preparing a working copy. A file that has already passed through a numeric conversion may have lost distinctions that cannot be recovered reliably by adding zeros later. Use the authoritative point register to resolve such a discrepancy instead of assuming every identifier should have the same width.
Separate CSV quoting from field typing
CSV syntax describes the arrangement and quoting of text fields. It does not, by itself, provide a universal application-level schema for a checkpoint register. Quoting a number-looking identifier may preserve its CSV field boundaries while a reader still chooses to interpret the contents numerically. GDAL explicitly documents a quoted-fields-as-string option for use with its type autodetection. This illustrates why the reading configuration belongs in the delivery contract. Do not rely on appearance in a text editor or on quotation marks alone to establish how the recipient application will expose a field.
Define identifier fields separately from numerical observations. Easting, northing and a height value need declared units and reference meanings, while a point label normally serves as a stable reference to evidence. A height column also needs its own vertical interpretation; giving it a Real datatype supplies no datum or measurement quality. Keep those definitions in a short data dictionary. If the same file carries status codes or target descriptions, decide their types explicitly as well. A convenient automatic guess can be wrong for a rare value appearing later in the file, even when the first records look consistent.

Product context only; this photograph does not depict the constructed examples in this article.
Create a matching CSVT for a working copy
The GDAL CSV driver supports a same-name csvt companion containing one comma-separated line of quoted field-type declarations. The declarations follow the CSV column order. For the constructed four-column schema below, the identifier is String and the coordinate-related fields are Real. This is a schema example without any surveyed coordinate rows. Prepare the companion for an identified working copy, preserve the accepted original and verify that the actual header order matches the declarations. A stale companion from a differently ordered revision can assign an inappropriate type even though both filenames appear to belong together.
Keep the CSV and its schema companion together in the receiving package. The example uses checkpoints.csv and checkpoints.csvt as illustrative names. If the source contains more or different columns, construct the schema from that actual table rather than copying the four-field example unchanged. Record the software and procedure that created the working copy. The CSVT convention is interpreted by supporting readers; other applications may need their own import settings. A schema file beside the CSV is useful evidence of intention, but acceptance still needs the recipient to demonstrate the resulting field definitions and values.
Constructed CSV header for checkpoints.csv:
point_id,easting,northing,height
One-line contents of its checkpoints.csvt companion:
"String","Real","Real","Real"Inspect types and selected identifiers read-only
Use a read-only layer summary to confirm the resulting schema. The command below disables type autodetection explicitly and asks ogrinfo to list layer summaries. With the intended CSVT available, inspect whether point_id is exposed as String and the numerical fields have their declared types. Follow that with record-level checks in the actual reader. A summary reports structure and counts, not whether the identifier content matches the accepted register. The command is documentation-reviewed guidance; no real checkpoint table was imported while preparing this article, and no output schema or count is fabricated.
For an independent text-level inspection, Python csv readers return strings by default unless a numeric-conversion option is selected. The small recipe below reads just the identifier field and prints its representation, making leading zeros visible. Use the documented encoding and delimiter for the actual table; UTF-8 with an optional byte-order mark is the assumed profile in this example. It does not compare coordinates, repair identifiers or write a derivative. Preserve the observed strings alongside the reader schema so a later analyst can distinguish source text from a value changed during import or export.
# Illustrative local input; inspect through the supporting GDAL reader.
ogrinfo -ro -al -so -oo AUTODETECT_TYPE=NO checkpoints.csv
# Separate Python text-level inspection; use in a Python environment:
import csv
with open("checkpoints.csv", encoding="utf-8-sig", newline="") as stream:
for row in csv.DictReader(stream):
print(repr(row["point_id"]))Test the keys used for joins and comparisons
Select representative identifiers from the accepted point register, including leading-zero labels, mixed letters and digits if present, and values near any special cases in the project naming policy. Confirm that they remain distinct after import and a controlled export from the receiving application. A row count cannot reveal that two labels collapsed to one numeric value or that an identifier was trimmed. Compare the actual key strings and review duplicate or missing identifiers explicitly. If a downstream join uses a transformed key, document that rule and preserve the original key rather than silently replacing it.
Keep identifier integrity separate from the analytical role of a point. A correctly preserved label does not establish that a checkpoint was excluded from model fitting, surveyed adequately or compared with the right surface. Those questions need their own project evidence. The import review should show which accepted observation each row refers to and whether that relationship survives the exchange. If an unmatched record appears, investigate its source and transformation history before deleting it from a validation table. An unexplained missing point can change the assessment population even when every remaining coordinate parses successfully.
Deliver the schema and its acceptance evidence
Package the accepted CSV identity, matching CSVT, data dictionary and reader instructions together. Record the observed field types, selected key checks, any warnings and the receiving software version. Include the treatment of empty fields, duplicate identifiers and intentional exclusions. If a recipient uses another import path, verify that path rather than assuming the same-name sidecar will be recognized. Keep the schema tied to the exact table revision so a later added or reordered column triggers review. The delivery should make both the intended interpretation and the observed import behavior clear to the next analyst.
For NiVO survey workflows, this is a small preparation step with a concrete purpose: preserve the link between a checkpoint record and its supporting evidence. It cannot restore an unknown identifier after information was discarded or validate the geodetic quality of the table. When the source is ambiguous, retain the original text and resolve the identity against the authoritative register. A successful handoff leaves the recipient with stable keys, explicit numerical fields and a repeatable import check, so later accuracy calculations do not inherit an unnoticed change introduced while opening a seemingly simple spreadsheet.



