/usr/share/doc/survex/3dformat-old.htm is in survex 1.2.33-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | <!DOCTYPE HTML PUBLIC "-//W4C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<TITLE>Survex 3d Format Specification (v3-v7)</TITLE>
<STYLE type="text/css"><!--
BODY, TD, TH, CENTER, UL, OL {font-family: sans-serif;}
TD, TH {font-size: 11pt; vertical-align: top;}
TH {white-space: nowrap; background-color: #ffc;}
.code {text-align: center; white-space: nowrap;}
.type {text-align: center; white-space: nowrap;}
.data {text-align: left; white-space: nowrap;}
.desc {text-align: left; white-space: wrap;}
.version {text-align: center; white-space: wrap;}
TH.data, TH.desc {text-align: center;}
.reserved {background-color: #ddd;}
-->
</STYLE>
</HEAD><BODY BGCOLOR=white TEXT=black>
<H1>Survex 3d Format Specification (v3-v7)</H1>
<P>If you're writing in C or C++ it's <b>strongly</b> recommended
that you use the img routine provided with Survex to read and write
3d files. Doing so means that you can take advantage of any revisions
to the 3d format by simply rebuilding your software with the updated
img routines, rather than having to update your own code. It also
allows you to read a sub-set of the data in the file, restricted by
Survey prefix.</P>
<P>This document only describes 3d format revisions 3 to 7 (inclusive).
Newer versions are described in a <a href="3dformat.htm">separate document</a>.
Older format versions are only documented by the code to read them in img.c -
they had version strings "v0.01", "Bv0.01", "bv0.01", and "v2").
</P>
<P>The following table document which Survex versions generate which 3d file
format versions. A version is able to read the format it generates and any
older versions, but in addition Survex 1.0.40 has support for reading all
versions up to v7 (but writes v3).
<table border="1" cellpadding="1" cellspacing="0" width="*">
<tr>
<th class="version">Format</th>
<th class="version" colspan=2>Survex versions</th>
</tr>
<tr>
<td class="version">v3</td>
<td class="version">0.97</td>
<td class="version">1.0.40</td>
</tr>
<tr>
<td class="version">v4</td>
<td class="version">1.1.0</td>
<td class="version">1.1.3</td>
</tr>
<tr>
<td class="version">v5</td>
<td class="version">1.1.4</td>
<td class="version">1.1.10</td>
</tr>
<tr>
<td class="version">v6</td>
<td class="version">1.1.11</td>
<td class="version">1.1.14</td>
</tr>
<tr>
<td class="version">v7</td>
<td class="version">1.1.15</td>
<td class="version">1.2.6</td>
</tr>
</table>
<P>If you try to use this specification and find details which aren't
spelled out clearly enough (or at all!) or any errors, please let us know.
At least two people have successfully written code to read 3d files
using this document, but that doesn't mean it can't be improved.
</P>
<H2>File Header</H2>
<P>This consists of:</P>
<ul>
<li>File ID: the string "Survex 3D Image File" followed by a linefeed
(decimal 10, hex 0a). [Note: v0.01 files can have a carriage return
before this and other linefeeds - this is a file format error in any
other format version].
<li>File format version: "v3", "v4", "v5", "v6", "v7" followed by a linefeed.
Any future versions will be "v8", "v9", "v10", "v11", etc.
<li> Survey title: A string followed by a linefeed. There's no length limit on this string.
<li> Timestamp: A string followed by a linefeed. This is intended to be the
time the file was generated, rather than the time the survey data was
collected. The easiest way to generate this is with the strftime() format
"%a,%Y.%m.%d %H:%M:%S %Z" if you have access to strftime(). An example
timestamp is "Sun,2002.03.17 14:01:07 GMT".
</ul>
<H2>Items</H2>
<P>Following the header are a number of items. The last item must be a 0x00
byte when the current label is empty, which marks the end of the data. The
first byte of an item is a code identifying what the item is:</P>
<table border="1" cellpadding="1" cellspacing="0" width="100%">
<tr>
<th class="code">Code</th>
<th class="code">Type</th>
<th class="data">Data</th>
<th class="desc" colspan="2">Meaning</th>
<th class="version">Version</th>
</tr>
<tr>
<td class="code">0x00</td>
<td class="type">STOP</td>
<td class="data"> </td>
<td class="desc" colspan="2">
If the current label is empty, signifies the end of the data in the 3d
file; if the current label isn't empty, make it empty.</td>
<td class="version">≥3</td>
</tr>
<tr>
<td class="code">0x01 - 0x0e</td>
<td class="type">TRIM</td>
<td class="data"> </td>
<td class="desc" colspan="2">
Trim the last 16 characters of the current label, then trim back N (i.e.
1-14) dots ("."), everything after that particular dot.
It's incorrect if the label ends up empty, or you attempt to trim more
label than there is. The rationale for removing 16 characters first is
that removal of 1-16 characters can be encoded by 0x10-0x1f (see below)
and we can make this encoding more powerful by not
overlapping what can be encoded.</td>
<td class="version">≥3</td>
</tr>
<tr>
<td class="code">0x0f</td>
<td class="type">MOVE</td>
<td class="data"><x> <y> <z></td>
<td class="desc" colspan="2">
Set current position to the coordinates given. Coordinates
are 4 byte little-endian signed integers representing
values in centimetres (0.01 metres).</td>
<td class="version">≥3</td>
</tr>
<tr>
<td class="code">0x10 - 0x1f</td>
<td class="type">TRIM</td>
<td class="data"> </td>
<td colspan="2">
Remove N-15 (i.e. 1-16) characters from the current label. It's
incorrect if the label ends up empty, or you attempt to trim more label
than there is.</td>
<td class="version">≥3</td>
</tr>
<tr>
<td class="code">0x20</td>
<td class="type">DATE (old version)</td>
<td class="data"><date></td>
<td colspan="2">
Set survey date of legs: date is 4 byte little-endian unsigned integer
counting seconds since 1970.</td>
<td class="version">≥4 and ≤6</td>
</tr>
<tr>
<td class="code">0x20</td>
<td class="type">DATE</td>
<td class="data"><date></td>
<td colspan="2">
Set survey date of legs: date is a 2 byte little-endian unsigned integer
counting days from the
start of 1900.</td>
<td class="version">≥7</td>
</tr>
<tr>
<td class="code">0x21</td>
<td class="type">DATE (old version)</td>
<td class="data"><date1><date2></td>
<td colspan="2">
Set survey date of legs to a range: date1, date2 are 4 byte little-endian
unsigned integer counting seconds since 1970.</td>
<td class="version">≥4 and ≤6</td>
</tr>
<tr>
<td class="code">0x21</td>
<td class="type">DATE</td>
<td class="data"><date1><datespan></td>
<td colspan="2">
Set survey date of legs to a range: date1 is a
2 byte little-endian unsigned integer counting days since the start of
1900, and datespan is an unsigned byte counting days from date1.</td>
<td class="version">≥7</td>
</tr>
<tr>
<td class="code">0x22</td>
<td class="type">ERROR</td>
<td class="data"><legs><length><E><H><V></td>
<td colspan="2">
Error information for the current traverse. <legs> is the number of
legs. <length> is the total length of the
traverse in cm (0.01m). E, H and V are the error and the horizontal and
vertical components in cm. (All values are 4 byte little-endian signed integers) </td>
<td class="version">≥6</td>
</tr>
<tr>
<td class="code">0x23</td>
<td class="type">DATE</td>
<td class="data"><date1><date2></td>
<td colspan="2">
Set survey date of legs to a range: date1, date2 are
2 byte little-endian unsigned integers counting days since the
start of 1900.</td>
<td class="version">≥7</td>
</tr>
<tr>
<td class="code">0x24</td>
<td class="type">DATE</td>
<td class="data"> </td>
<td colspan="2">
No survey date information was specified.</td>
<td class="version">≥7</td>
</tr>
<tr class="reserved">
<td class="code">0x25 - 0x2f</td>
<td class="type"> </td>
<td class="data"> </td>
<td colspan="3">Reserved</td>
</tr>
<tr>
<td class="code" rowspan="3">0x30 - 0x31</td>
<td class="type" rowspan="3">XSECT</td>
<td class="data" rowspan="3"><len> <label> <L> <R> <U> <D></td>
<td colspan="2">
Dimensions are 2 byte little-endian signed integers representing values
in centimetres (0.01 metres). Omitted dimensions are encoded as 0xffff.
Station flags are (N & 0x01): </td>
<td class="version" rowspan="3">≥5</td>
</tr>
<tr>
<th>Flag (N & 0x01)</th>
<th>Meaning</th>
</tr>
<tr>
<td>0x01</td>
<td>Station is last one in this passage</td>
</tr>
<tr>
<td class="code" rowspan="3">0x32 - 0x33</td>
<td class="type" rowspan="3">XSECT</td>
<td class="data" rowspan="3"><len> <label> <L> <R> <U> <D></td>
<td colspan="2">
Dimensions are 4 byte little-endian signed integers representing values
in centimetres (0.01 metres). Omitted dimensions are encoded as
0xffffffff.</td>
<td class="version" rowspan="3">≥5</td>
</tr>
<tr>
<th>Flag (N & 0x01)</th>
<th>Meaning</th>
</tr>
<tr>
<td>0x01</td>
<td>Station is last one in this passage</td>
</tr>
<tr class="reserved">
<td class="code">0x34 - 0x3f</td>
<td class="type"> </td>
<td class="data"> </td>
<td colspan="3">Reserved</td>
</tr>
<!-- Checked to here! -->
<tr>
<td class="code" rowspan="13">0x40 - 0x7f</td>
<td class="type" rowspan="13">LABEL</td>
<td class="data" rowspan="13"><len> <label> <x> <y> <z></td>
<td colspan="2">
Append label to the current label buffer. The updated contents of the
label buffer give the survey stations full name. The length of label is
given by length, which is encoded as follows:</td>
<td class="version" rowspan="12">≥3</td>
</tr>
<tr>
<th>Length</th>
<th>Encoding</th>
</tr>
<tr>
<td>0 - 253</td>
<td>byte 0x00 - 0xfd</td>
</tr>
<tr>
<td>254-65789</td>
<td>byte 0xfe 2 byte little-endian unsigned integer len-254 0x0000-0xffff</td>
</tr>
<tr>
<td>65790 and greater</td>
<td>byte 0xff 4 byte little-endian unsigned integer len
0x000100fd-0xffffffff</td>
</tr>
<tr>
<td colspan="2">
The station flags are encoded in the bottom 6 bits of the item code:</td>
</tr>
<tr>
<th>Flag (N & 0x3f)</th>
<th>Meaning</th>
</tr>
<tr>
<td>0x01</td>
<td>Station is on leg above ground</td>
</tr>
<tr>
<td>0x02</td>
<td>Station is on an underground leg (both may be true at an entrance)</td>
</tr>
<tr>
<td>0x04</td>
<td>Station is marked as an entrance (with *entrance)</td>
</tr>
<tr>
<td>0x08</td>
<td>Station is exported (i.e. may be used as a connection point to other
surveys)</td>
</tr>
<tr>
<td>0x10</td>
<td>Station is a fixed point (control point)</td>
</tr>
<tr class="reserved">
<td>0x20</td>
<td colspan="2">Reserved</td>
</tr>
<tr>
<td class="code" rowspan="8">0x80 - 0xbf</td>
<td class="type" rowspan="8">LINE</td>
<td class="data" rowspan="8"><len> <label> <x> <y> <z></td>
<td colspan="2">
Append label to the current label buffer. The length of the label is
encoded as for a station label above. Return leg from current position
to coordinates given, and update current position to coordinates given.
The updated contents of the label buffer give the survey that the leg is
in.</td>
<td class="version" rowspan="5">≥3</td>
</tr>
<tr>
<th>Flag (N & 0x3f)</th>
<th>Meaning</th>
</tr>
<tr>
<td>0x01</td>
<td>Leg is above ground</td>
</tr>
<tr>
<td>0x02</td>
<td>Leg duplicates data in another leg (e.g. resurvey along a passage to
tie into a known station)</td>
</tr>
<tr>
<td>0x04</td>
<td>Leg is a splay shot in a chamber (radial shots from a central point)</td>
</tr>
<tr class="reserved">
<td>0x08</td>
<td colspan="2">Reserved</td>
</tr>
<tr class="reserved">
<td>0x10</td>
<td colspan="2">Reserved</td>
</tr>
<tr class="reserved">
<td>0x20</td>
<td colspan="2">Reserved</td>
</tr>
<tr class="reserved">
<td class="code">0xc0 - 0xff</td>
<td class="type"> </td>
<td class="data"> </td>
<td colspan="3">Reserved</td>
</tr>
</table>
<H2>Item order</H2>
<ul>
<li>A continuous section of centreline is defined by a <MOVE> item, followed
by one or more <LINE> items.</li>
<li><LABEL> items may appear anywhere in the file after the header,
including within a <MOVE><LINE>... sequence.</li>
<li>Duplicate <LABEL> items are permitted provided they also have identical
coordinate values. (The same coordinate values may also be shared by any
number of different <LABEL> items).</li>
<li>Stations must be defined in a <LABEL> item <u>before</u> being
referenced (e.g. in <XSECT> items)</li>
</ul>
<P>Authors: Olly Betts and Mike McCombe, last updated: 2013-07-05</P>
</BODY></HTML>
|