dohypackLNW
Description
dohypackLNW performs bidirectional conversion between OMG segmented ASCII lat lon label (.llz) planned survey line files and HYPACK .LNW (Line File) UTM planned line files:
-jhc2hy(default): Converts an OMG.llzfile (where individual survey lines are separated by0.0 0.0 <label>sentinel rows) into a HYPACK.LNWfile (LNS,LIN,PTS easting northing,LNN,EOL) using forward UTM projection (geoutm).-hy2jhc: Converts a HYPACK.LNWfile into an OMG.llzfile (inserting0.0 0.0 0.0beforeLINand0.00 0.00 0.00atLNN) using inverse UTM projection (utmgeo).
Both conversions use the WGS84 ellipsoid (Ellipsoid = 1) and Northern Hemisphere ('n'), with the UTM central meridian specified via -merid <deg> (or prompted interactively on stdin if omitted).
Usage
dohypackLNW [-jhc2hy | -hy2jhc] [-merid <deg>] [-skipline <N>] -in <infile> -out <outfile>
Common Workflow Examples
1. Convert OMG planned lines (.llz) to a HYPACK .LNW file (UTM Zone 20N, central meridian -63.0°):
dohypackLNW -jhc2hy -merid -63.0 -in planned_lines.llz -out survey_plan.LNW
2. Convert a HYPACK .LNW file to an OMG .llz file for display in jview:
dohypackLNW -hy2jhc -merid -63.0 -in survey_plan.LNW -out planned_lines.llz
3. Skip a 1-line header in the input .llz file before converting to .LNW:
dohypackLNW -jhc2hy -skipline 1 -merid -123.0 -in header_lines.llz -out lines.LNW
Arguments
| Option | Description | Default |
|---|---|---|
-in <filename> | Required. Input filename (OMG .llz when -jhc2hy, or HYPACK .LNW when -hy2jhc). | None |
-out <filename> | Required. Output filename (HYPACK .LNW when -jhc2hy, or OMG .llz when -hy2jhc). | None |
-jhc2hy | Convert OMG .llz (lat lon label) to HYPACK .LNW (whichway = 1). | Default (1) |
-hy2jhc | Convert HYPACK .LNW to OMG .llz (whichway = -1). | Disabled |
-merid <deg> | UTM central meridian in decimal degrees longitude (e.g., -63.0). If omitted (0), prompts interactively on stdin: meridian? (decimal longitude please (e.g. -63.0) ** NOTE hardwired to Northern Hemisphere - -WGS84). | 0.0 (prompts if 0) |
-skipline <N> | Number of initial lines to skip at the top of the input file before parsing. | 0 |
-debug | In -jhc2hy mode, writes intermediate debug lines (lineno point_lineno pointinline lat lon east north) to the output file before the LNS block. | Disabled |
-v | Enable verbose flag (verbose_flag). | Disabled |
[!NOTE] Any unrecognized positional argument on the command line triggers
usage(" weird command line arg?.. %s .", *argv). Always prefix the input and output files with-inand-out.
Input & Output Format Details
OMG .llz Format
Whitespace-delimited ASCII lines containing lat lon label (up to 1,000 points across up to 100 lines):
0.0 0.0 0.0
45.123456 -63.123456 0.0
45.234567 -63.234567 0.0
0.0 0.0 0.0
Rows where lat == 0 && lon == 0 act as polyline segment separators.
HYPACK .LNW Format
LNS <total_number_of_lines>
LIN <num_points_in_line>
PTS <easting_m> <northing_m>
PTS <easting_m> <northing_m>
LNN <line_index>
EOL
How It Works
- Validates that both
-inand-outwere supplied, setsEllipsoid = 1(WGS84), and prompts formeridonstdinif-meridwas not passed. - Opens the input and output files and skips
-skiplineinitial lines. - In
-jhc2hymode (whichway == 1):- Reads all
(lat, lon, label)tuples intoPoints[]. - Iterates over all points: when
(lat == 0 && lon == 0)is encountered after a non-zero point, incrementsnolinesandlineno. Otherwise, projects(lat, lon)to UTM(east, north)viageoutm()and appends the point index toLines[lineno]. - Writes the
LNS <nolines>header, followed byLIN,PTS,LNN, andEOLblocks for each line.
- Reads all
- In
-hy2jhcmode (whichway == -1):- Scans the
.LNWfile line-by-line: writes0.0 0.0 0.0onLIN, convertsPTS <east> <north>tolat lon 0.0viautmgeo(..., 'n'), and writes0.00 0.00 0.00onLNN.
- Scans the