Import and export#

Every file format is an exporter (solved line → file) or an importer (file → line file). The built-in formats and those of file-format plugins look the same: list them with

ohl formats [--plugin DIR]
id direction contents
structures-csv both structure,x,y,z,orientation_deg,type,extension; import: any columns (neutral files)
wires-csv export case,section,span,circuit,phase,index,x,y,z for every weather case (jumpers: section jumper:<id>)
spans-csv export one row per span and weather case: structures, horizontal span, horizontal and largest tension, sag
kml, kmz export structures (points) and wires (one folder per weather case) in WGS84 for Google Earth and GIS
ohl-xml both the whole line model as OHL XML; import also reads LandXML
landxml export routes as LandXML 1.2 alignments (with a profile of the alignment points), structures as CgPoints
geojson export GIS layers: structures, routes, wires per weather case with tensions and sag (WGS84)
structures-geojson import structures from GeoJSON points along a LineString
shapefile export the GIS layers as ESRI shapefiles, zipped (.zip)
structures-shp import structures from shapefile points (.shp, or a zip with its .dbf)
gpkg export the GIS layers as an OGC GeoPackage
ifc export IFC4 structures and wires for BIM programs
xlsx export tables as an Excel workbook

All of them are written directly by OpenOHL from the public specifications (no GDAL or other native library). Exports take time in proportion to the size of the model (milliseconds for the example line with several weather cases).

Export#

Exports are written by ohl line after solving, so they use the same libraries, structure files and weather cases (--weather, --case, --tag):

ohl line examples/synthetic-line/synthetic-line.ohl.json \
    --export line.kmz --export wires-csv=wires.csv --option crs=EPSG:2056

--export FILE picks the format from the extension (the first exporter for it: .csv → structures-csv, .xml → ohl-xml, .zip → shapefile); --export FORMAT=FILE names it, e.g. landxml=line.xml. --option KEY=VALUE passes options to the formats (repeatable). In the application, File › Export › The line… lists the same formats.

KML/KMZ options:

  • crs — the line's coordinate system, when the line file has none (or an informative one such as local (invented)). Coordinates go to WGS84 through ohl-crs; heights are kept (altitudeMode absolute: the line's heights above sea level).
  • cases — first (default) or all weather cases.

Wire colours come from the sections (colours).

GIS layers#

GeoJSON, Shapefile and GeoPackage hold three layers:

layer geometry attributes
structures point (x, y, z) id, type, extension, orient_deg, routes
routes line id, name, structures (ids in order)
wires line, one per span (or jumper) and weather case case, section, span (from 1), circuit, phase, system, voltage_kv, color, h_tens_n (horizontal tension, N), max_tens_n (largest tension, N), sag_m

Options:

  • coordinates — wgs84 (longitude, latitude; heights kept) or line (the line's coordinate system). Default: wgs84 for GeoJSON (as RFC 7946 asks; with line, the file names the system in a crs member), line for shapefiles and GeoPackage.
  • crs — the line's coordinate system, when the line file has none.
  • cases — all (default) or first weather case.

Shapefiles come as one zip with structures, routes and wires (.shp, .shx, .dbf, and .cpg saying the text is UTF-8); most GIS programs open the zip directly. Point layers are PointZ, lines PolyLineZ. A .prj is written for WGS84 output only: for the line's coordinates, set the layer's coordinate system in the GIS program. Text attributes are cut at 254 bytes.

GeoPackage (.gpkg, version 1.2): feature tables structures (POINT Z), routes and wires (LINESTRING Z). A line coordinate system EPSG:<code> is registered under that code (GIS programs take the definition from the code); without one the layers use the undefined Cartesian system. No spatial index is written.

LandXML#

landxml writes each route as an Alignment — CoordGeom straight lines between its alignment points (or its structures, for a route without an alignment), stationing from 0, and a Profile with the heights of those points — and every structure as a CgPoint named by its id (code: its type). Points are northing, easting, elevation, in metres; a coordinate system EPSG:<code> is written as CoordinateSystem. Terrain surfaces are written and read apart (Line › Terrain › Terrain surfaces).

IFC#

ifc writes an IFC4 file (STEP, ReferenceView): a project with metre, radian, newton and volt units and a site placed at the first structure. Each structure is an IfcBuildingElementProxy placed and turned like the structure, drawn as 3D lines (its stick drawing; else a shaft with arms to the attachment points) and its strings, with property set OHL_Structure (id, type, extension, orientation, routes). Each span or jumper is an IfcCableSegment (CONDUCTORSEGMENT) drawn as a 3D polyline, with property set OHL_Wire (case, section, span, cable, circuit, phase, system, nominal voltage, horizontal and largest tension, sag). Option cases: first (default) or all. Coordinates are the line's; no map conversion is written.

Tables (XLSX)#

xlsx writes a workbook with the sheets Structures, Sections, Spans (every span and jumper of every weather case: tensions and sag), Stations (stationing, offsets, line angles of every route) and, when ohl line computes them (--load-cases), Structure loads and Structure usage — the same tables as --loads-csv and --usage-csv. spans-csv writes the Spans sheet as CSV.

Safety volumes#

The safety volumes around the wires (Checks › Safety volumes, ohl safety-volume) are written by their own export as DXF (with a .prj), IFC4 with IfcMapConversion and KML/KMZ: see Safety volumes.

Import#

ohl import positions.csv --into line.ohl.json --out line-moved.ohl.json
ohl import survey.csv --format structures-csv --out new-line.ohl.json
ohl import line.xml --out line.ohl.json

The format comes from --format or the file extension. With --into, the file updates that line; without, it makes a new line. The result is checked like any line file before it is written. In the application, File › Import › Into the line… reads a file into the open line as one command (undone at once).

Into a project file — a new one, or one that holds a line — as one logged command:

ohl project import-file points.geojson --into new.ohl --user ann --option crs=EPSG:2056 --option type=tangent

ohl-xml reads an OHL XML line (it replaces the line). It recognises LandXML too: its CgPoints become structures along the first alignment (option alignment: by name), as for the neutral files; a LandXML file with an alignment but no points updates the alignment of a route (option route, default the first) of the line it is imported into. Curves and spirals are read by their end points.

Neutral files: points and a route#

structures-csv, structures-geojson, structures-shp and LandXML points are read the same way:

  • Every point becomes a structure; a point whose id is a structure of the line moves and turns it — attachments, strings and stick drawings move with it — and keeps its type unless the file gives one.
  • With a polyline in the file (a GeoJSON LineString, the first shapefile polyline — a routes shapefile in the zip first —, a LandXML alignment), the points are ordered by their station along it, and the route route (default main) runs through them with the polyline as its alignment. A new line always gets that route (in file order without a polyline).
  • New structures without an orientation are turned square to the bisector of the line at them.
option meaning
type structure type of new structures without one (from the structure library)
prefix id prefix of points without an id (default P: P1, P2…)
route the route made or replaced (default main)
order station (default, along the polyline) or file
crs coordinate system of a new line (a line imported into keeps its own)
source_crs coordinate system of the file, if it does not say
z height of points without one, m (default 0)
name name of a new line
id GeoJSON property or shapefile column holding the ids (default id, name or structure)

Coordinates are converted from the file's system to the line's (ohl-crs). GeoJSON is longitude, latitude (WGS84) unless it names a system in a crs member; a zipped shapefile with a WGS84 .prj is too; CSV and other shapefiles are taken in the line's coordinates (or source_crs). Points in longitude and latitude need the line's system: --option crs=EPSG:<code> for a new line.

structures-csv needs columns x and y; structure, z, orientation_deg, type and extension are optional (an empty cell keeps the current value). Other column names are given as <column>_column options, the separator with delimiter (,, ; or tab):

ohl import survey.csv --format structures-csv --out new.ohl.json \
    --option delimiter=';' --option x_column=Easting --option y_column=Northing --option z_column=H \
    --option structure_column=Nr --option type=tangent

Formats from plugins#

A WebAssembly plugin with the extension point io adds formats (see Writing plugins); --plugin DIR loads it for ohl formats, ohl import, ohl project import-file and ohl line --export. A plugin format with the id of a built-in one replaces it. The example plugin plugins/examples/geojson exports GeoJSON in the line's coordinate system (format example-geojson, beside the built-in geojson, which writes WGS 84) and imports structures from GeoJSON points:

(cd plugins/examples/geojson && cargo build --release --target wasm32-wasip2)
ohl line line.ohl.json --export example-geojson=line.geojson --plugin plugins/examples/geojson
ohl import points.geojson --plugin plugins/examples/geojson --format geojson-structures --into line.ohl.json --out moved.ohl.json

A plugin error, a crash, or a plugin exceeding its time or memory limit is reported as the format's error; the line is never half-written.

Projects from other programs#

A project plugin reads another program's project file into a new OpenOHL project: the line (structures and attachments, sections and their stringing, circuits as electrical systems, jumpers, point loads, alignment) and its libraries (wires, weather cases, load cases), with notes on what was read, left out or assumed.

  • In the application: File › New project from another program… (also on the start page): the file, the format (default: from the extension), options, then where to save the new .ohl. It runs in the background; the project opens with a window of the reader's notes.

  • From the command line:

    ohl project import-from FILE --into new.ohl --user ann --plugin DIR [--format F] [--option KEY=VALUE] [--library FILE]… [--clip-in]
    

Library files the export lacks (2026-10-27): Add library files… in the window (--library FILE, repeatable) adds library files of your own to what was read — e.g. an export cut off before its cable data, which would otherwise import with no cables and every section unsolved. Their kind comes from the extension: wire types .ohlw, clearance rules .ohlr, structure types .ohls, insulators .ohli, weather cases .ohlwc, load cases .ohllc, galloping .ohlg, ambient .ohlta, costs .ohlcost, poles .ohlp, structure models .ohlfe, cross-sections .ohlsec, bolts .ohlb (2026-11-02); another file is refused. They are written into the project with the import (a file of the same name as one the export holds replaces it), and the reader's notes list each one. They are added before clip in, which needs the wire types.

Clip in (--clip-in, or the window's tick): sections the reader left in the blocks are clipped in at their stringing condition, so each span keeps its length — as programs that sag a section with a ruling span and then solve it with fixed lengths do.

Safe mode (2026-10-27; built, in active development, not approved yet): an export with faults is imported as far as it reads, never refused for one fault, and every fault is said in the notes as a warning: — check them, things may be missing or need mending:

  • an empty value where a list or a number is expected: left out (the field's default);
  • an id given twice (two structures of the same name): the later ones kept as <id>-2, -3… (what refers to the id keeps the first);
  • an object that does not read on its own (a structure, a section, a jumper…): left out, by id;
  • a line that reads but does not check: two sections joined by a jumper but given different electrical systems of the same voltage — the later takes the first's system and phase (every wire and jumper kept); otherwise the object whose removal gets past the check is left out, a jumper first;
  • a wire file the wire library would refuse: the cables that load are kept, each once (a cable given twice: the first); a cable that does not load is left out, and the sections on it find no wire.

A reader that meets a file cut off or broken part-way reads up to the fault and says where (the plugin's own notes).

Into an existing project#

File › Import › Another project into this one… (2026-10-25) reads another program's project file the same way and brings it into the project open — other lines of the same project, a neighbouring line, a later state of the same line, a variant of part of it:

  1. How (2026-10-27): Replace what the import covers (a variant), the default, or Add to the project (keep the project's) — see below.

  2. The file: the format (default: from the extension), options, clip in, Add library files… (the files the export lacks, as above; they are part of what is read, so they are merged like the import's own — cables by id into the project's wire file); Read the file (in the background; nothing changes yet; files added after reading need Read the file again).

  3. Into which project line? The line you work on (one change, undoable), or a new project line made from it (named; you then work on it — to look at the import apart and bring it into another line later with Versions › Bring in changes).

  4. Its routes: each of the import's routes is this project's route … (its alignments join that route) or a new route (renamed if its id is taken). A route of an id the project has is taken to be the same by default; in Replace mode otherwise the project's route whose alignment points the import's meet (two or more within the tolerance).

  5. What the import removes (Replace mode): see below.

  6. What appears in both: an object of the same id with other values, or of another id at the same place — an alignment point nearer than the tolerance in plan (1 m by default), a section over the same structures and sets, a jumper between the same ends — and a library file of the same name with another text. Each is listed with what differs and settled: keep the project's (the default in Add mode: the imported one left out, what the import attached to it attached to the project's), take the imported one (the default in Replace mode: it replaces the project's, under the project's id) or keep both (the imported one under an id of its own, P12 (2), what refers to it following; never the default). All: settles every one alike. What is the same in both is left as it is; the rest is added. The ids the import's objects were given are listed.

  7. Structures in both (2026-10-27): a structure of the import within the tolerance of one of the project's — of its id or another — is kept once, each structure with its choice: take the imported one (the default in Replace mode: the imported structure as it is — position, orientation, type, sets — under the project's id; the project's sets it lacks stay on it where what the line keeps still hangs on them, else they go with the project's structure) or keep the project's (the default in Add mode: its id, position, orientation and type, the import's sets settled one by one). It is listed in one line (its sets in each, how many the same, at other places, taken from the import or kept for what stays); opened, it shows every set number of either side by side — the project's and the imported wire point (in still air, in world coordinates, so structures turned differently in the two files compare right) and how far apart they are. When the project's structure is kept:

    • a set only in the import: add (the default) or leave out (the imported sections and jumpers at it are left out with it);
    • a set in both at the same place (within the tolerance): the same attachment, nothing to choose;
    • a set in both at other places: keep the project's (the default; the imported sections at that set hang on the project's), take the imported one (it replaces the project's wire point and strings of that set) or add the imported one under a new number (a free number on the structure; the imported sections at it follow).

    A set added brings the imported structure's wire point and the strings above it, up to the structure points, as the project structure's own items (a structure point of the project's structure at the same place is used instead of a new one); labels are made unique on the structure and string directions turned into the project structure's axes. The imported structure is taken as it is in effect, merged with its type from the import's own files, since its wire points may be in its type file. Its type file is not added when only structures in both kept as the project's use it.

Replace: a variant of a stretch (2026-10-27). An export that holds only part of the line — a few structures moved, one added, others gone — is taken as the new state of that part: the line outside it stays, inside it the import's structures, sections and jumpers take the place of the project's.

  • The stretch is found from the structures in both. Two of them the import goes between with no other structure in both between them — along its sections, over its own new structures too (a section ending at a new strain structure, the next going on from it), or along its alignments when it has no section — mark a gap. The project's structures in that gap, along its alignments (in station order) or along its sections, are not in the import: they are removed. A project without a route still has its sections; a single structure in both covers nothing.
  • Sections removed: those at a removed structure, and those over structures in both only whose every span the import covers; a section the import has at the same place (the same structures and sets) is settled as appearing in both instead. A section that runs out of the stretch through a removed structure is split at the stretch's end (2026-10-27): its part outside the stretch stays as a section of its own (the first under its id; its spans, span points and stringing — a clipped-in section's lengths — kept), the part inside goes; a note says so. Sections of a circuit the import does not carry at all are removed like the others (the default decided 2026-10-27): keep them in the list when the variant only left out an unchanged circuit.
  • Spans drawn again to a moved end (2026-10-27): a section of the project from a structure in both to one the import does not have is removed too when the import has a span from that same structure ending within 10 % of the span's length of it — an older copy of the far end (e.g. a substation the project holds twice, 20 m apart, the variant drawn to the other copy). The far end is removed with it when nothing else hangs on it. Both are listed (keep them there).
  • Jumpers removed: those at a removed structure or on a tap of a removed section, and those whose every end is at a structure in both inside the stretch. Jumpers at the stretch's ends (structures in both next to a structure that stays) are kept: they join what stays outside to what comes in. The sections and jumpers that stay at an end structure hang on the imported structure's set of their number; a set the imported structure has not is kept from the project's structure.
  • A structure of another id at the same place takes the imported id (it is the import's structure); what refers to it — sections, jumpers outside the stretch, alignment points — follows. Unless the project gives that id to another structure, or the structure is set to keep the project's.
  • A structure near none of the project's (beyond the tolerance) is added; the project's structure it replaces in the design is removed with the stretch.
  • The alignment: an imported alignment with two or more points in common with one of the project's (on the same route) replaces the part of it between the first and the last of them; the project's points taken off it that are on no other alignment leave the line.
  • Every removal is listed (structures, sections, jumpers, with why), each remove (default) or keep; one at a removed structure goes with it.
  • Cables in both with other data: the imported one replaces the project's in the project's wire file, under its id (default in Replace mode).
  • Names along a conductor (2026-10-27): where an imported section and a project section are one conductor (joined by a jumper or a shared attachment) but name different circuits or phases of the same voltage — a variant reconnecting circuits, a by-pass —, the import's names win: the project's sections joined to it take its system and phase, along the whole conductor (outside the stretch too), each change listed in the notes to be checked. (In Add mode the project's names win; different voltages: the joining jumper is left out, said.)

In Add mode nothing is removed and what is in both stays the project's unless chosen otherwise.

Kept apart without asking: a structure of the same id further away than the tolerance is another structure: it comes in under an id of its own (T12-2) with its type, and a note gives the distance. If the project holds another type file of that name, or another type of that id, the import's type comes in under a new id (type-2, in a file of that name) and the structure names it. Alignment points of the same id elsewhere, and sections, jumpers and alignments of the same id over other structures or on another route, are kept apart the same way (programs number them alike in every file).

Wire and structure type files by what they hold: wire files are compared cable by cable, so the project keeps one of each cable. A cable the project has with the same data is left out; a new cable is added to the project's wire file (the first by name when it has several, said in a note); a cable of the project's id with other data is listed — keep the project's (the default in Add mode; the imported sections use it), take the imported one (the default in Replace mode: it replaces the project's cable in its file, under its id) or keep both (the imported one under a new id, cable-2, added likewise; the imported sections and jumpers name it). A project without a wire file gets the import's as it is. A cable the wire library would refuse is left out with a note, so the library keeps loading. Structure type files are compared by type id; a type file whose name is taken by another type is added under a name of its own. Before Import the window says which structures' types would be in no type file of the project afterwards. Other library files are compared by name.

The window keeps to the screen: what is to settle scrolls, and the summary line (added, taken, removed, structures in both), Import and the status stay in sight below it.

Import writes the library files, then the line as one change (one Undo takes the whole line back; the library files written stay). The coordinate systems must be the same (else reproject one first). The renames are made with the project's own rename (what refers to an object follows as when it is renamed by hand).

From the command line, the same without the window (in active development):

ohl project import-into FILE --into project.ohl --user ann --plugin DIR [--format F] \
    [--option KEY=VALUE] [--library FILE]… [--clip-in] [--tolerance M] [--route ID=existing|new|ROUTE] \
    [--mode replace|add] [--choose KEY=keep|imported|both] [--choose tower:T3=keep|imported] \
    [--choose tower:T3:set:2=add|leave|keep|imported|new] \
    [--choose remove:structure:T7=remove|keep] [--dry-run]

It prints the plan — the mode, what each route became, what is added and the same, what is removed (removed: structures …; sections …; jumpers …, then each with why and its key), the structures in both with their choice, sets and keys, what appears in both with its key, the ids given, the library files written, the notes — then writes it (not with --dry-run) and says whether the project's wire library loads.

Terrain (TIN) and point clouds are imported apart, also from File: Import › Terrain surface (TIN)… (Line › Terrain › Terrain surfaces) and Import › LiDAR points (LAS/LAZ)….

View this page's source on GitHub