[618b01f] | 1 | <!DOCTYPE HTML PUBLIC "-//W4C//DTD HTML 4.0 Transitional//EN"> |
---|
[2d82f2a] | 2 | <HTML><HEAD> |
---|
| 3 | <TITLE>Survex 3d Format Specification</TITLE> |
---|
| 4 | <STYLE type="text/css"><!-- |
---|
[618b01f] | 5 | BODY, TD, TH, CENTER, UL, OL {font-family: sans-serif;} |
---|
| 6 | TD, TH {font-size: 11pt; vertical-align: top;} |
---|
| 7 | TH {white-space: nowrap; background-color: #ffc;} |
---|
| 8 | .code {text-align: center; white-space: nowrap;} |
---|
| 9 | .type {text-align: center; white-space: nowrap;} |
---|
| 10 | .data {text-align: left; white-space: nowrap;} |
---|
| 11 | .desc {text-align: left; white-space: wrap;} |
---|
| 12 | .version {text-align: center; white-space: wrap;} |
---|
| 13 | TH.data, TH.desc {text-align: center;} |
---|
| 14 | .reserved {background-color: #ddd;} |
---|
[2d82f2a] | 15 | --> |
---|
| 16 | </STYLE> |
---|
| 17 | </HEAD><BODY BGCOLOR=white TEXT=black> |
---|
| 18 | <H1>Survex 3d Format Specification</H1> |
---|
| 19 | |
---|
[618b01f] | 20 | <P>If you're writing in C or C++ it's <b>strongly</b> recommended |
---|
| 21 | that you use the img routine provided with Survex to read and write |
---|
| 22 | 3d files. Doing so means that you can take advantage of any revisions |
---|
| 23 | to the 3d format by simply rebuilding your software with the updated |
---|
| 24 | img routines, rather than having to update your own code. It also |
---|
| 25 | allows you to read a sub-set of the data in the file, restricted by |
---|
| 26 | Survey prefix.</P> |
---|
[2d82f2a] | 27 | |
---|
[ec812baa] | 28 | <P>This document only describes the most recent revision of the 3d format |
---|
| 29 | (version 8) which is produced by versions from 1.2.7. A <a |
---|
| 30 | href="3dformat-old.htm">separate document</a> describes older versions. |
---|
| 31 | </P> |
---|
[618b01f] | 32 | |
---|
| 33 | <P>If you try to use this specification and find details which aren't |
---|
| 34 | spelled out clearly enough (or at all!) or any errors, please let us know. |
---|
| 35 | At least two people have successfully written code to read 3d files |
---|
| 36 | using this document, but that doesn't mean it can't be improved. |
---|
| 37 | </P> |
---|
[2d82f2a] | 38 | |
---|
| 39 | <H2>File Header</H2> |
---|
| 40 | |
---|
[618b01f] | 41 | <P>This consists of:</P> |
---|
[2d82f2a] | 42 | |
---|
| 43 | <ul> |
---|
[afe350e] | 44 | <li> File ID: the string "Survex 3D Image File" followed by a linefeed |
---|
| 45 | (decimal 10, hex 0a). [Note: v0.01 files can have a carriage return |
---|
[618b01f] | 46 | before this and other linefeeds - this is a file format error in any |
---|
| 47 | other format version]. |
---|
[ec812baa] | 48 | <li> File format version: "v8" followed by a linefeed. |
---|
| 49 | Any future versions will be "v9", "v10", "v11", etc. |
---|
[17ec06d] | 50 | <li> Assorted string metadata - the sublist below lists these, and they |
---|
| 51 | must appear in the order given, separated by zero bytes, with the end of |
---|
| 52 | the metadata marked by a linefeed. More items may be added, so ignore any |
---|
| 53 | additional ones which are present. Any trailing items with empty values |
---|
| 54 | can be omitted along with the separating zero byte before them. |
---|
| 55 | <ul> |
---|
| 56 | <li>Survey title: Human readable description of the data in the file. |
---|
| 57 | There's no length limit on this string. |
---|
| 58 | <li>Coordinate system: PROJ4 string describing the coordinate |
---|
| 59 | system in use. |
---|
| 60 | </ul> |
---|
[ec812baa] | 61 | <li> Timestamp: A string consisting of an '@' followed by a count of |
---|
| 62 | seconds since the start of 1970 in UTC ("Unix time_t") as a string |
---|
| 63 | (for example: "@1371300355"), followed by a linefeed. This is intended to be |
---|
| 64 | the time the file was generated, rather than the time the survey data was |
---|
| 65 | collected. |
---|
[73fea40] | 66 | <li> File-wide flags: a single byte. If bit 7 is set, this is an extended |
---|
| 67 | elevation. All other bits are reserved - set them to 0 when writing, and |
---|
| 68 | ignore them when reading. |
---|
[2d82f2a] | 69 | </ul> |
---|
| 70 | |
---|
| 71 | <H2>Items</H2> |
---|
| 72 | |
---|
| 73 | <P>Following the header are a number of items. The last item must be a 0x00 |
---|
| 74 | byte when the current label is empty, which marks the end of the data. The |
---|
[618b01f] | 75 | first byte of an item is a code identifying what the item is:</P> |
---|
[760a6550] | 76 | |
---|
[618b01f] | 77 | <table border="1" cellpadding="1" cellspacing="0" width="100%"> |
---|
| 78 | <tr> |
---|
| 79 | <th class="code">Code</th> |
---|
| 80 | <th class="code">Type</th> |
---|
| 81 | <th class="data">Data</th> |
---|
| 82 | <th class="desc" colspan="2">Meaning</th> |
---|
| 83 | <th class="version">Version</th> |
---|
| 84 | </tr> |
---|
| 85 | <tr> |
---|
| 86 | <td class="code">0x00</td> |
---|
[dec6b10] | 87 | <td class="type">STYLE_NORMAL / STOP</td> |
---|
[618b01f] | 88 | <td class="data"> </td> |
---|
[dec6b10] | 89 | <td colspan="2"> |
---|
| 90 | Set style for following legs to tape, compass and clino. |
---|
| 91 | <p> |
---|
| 92 | If the style is already set to STYLE_NORMAL, this code signifies the |
---|
| 93 | end of the data in the 3d file.</td> |
---|
[ec812baa] | 94 | <td class="version">≥8</td> |
---|
[618b01f] | 95 | </tr> |
---|
| 96 | <tr> |
---|
[dec6b10] | 97 | <td class="code">0x01</td> |
---|
| 98 | <td class="type">STYLE_DIVING</td> |
---|
[618b01f] | 99 | <td class="data"> </td> |
---|
[dec6b10] | 100 | <td colspan="2"> |
---|
| 101 | Set style for following legs to diving data</td> |
---|
| 102 | <td class="version">≥8</td> |
---|
| 103 | </tr> |
---|
| 104 | <tr> |
---|
| 105 | <td class="code">0x02</td> |
---|
| 106 | <td class="type">STYLE_CARTESIAN</td> |
---|
| 107 | <td class="data"> </td> |
---|
| 108 | <td colspan="2"> |
---|
| 109 | Set style for following legs to cartesian data</td> |
---|
| 110 | <td class="version">≥8</td> |
---|
| 111 | </tr> |
---|
| 112 | <tr> |
---|
| 113 | <td class="code">0x03</td> |
---|
| 114 | <td class="type">STYLE_CYLPOLAR</td> |
---|
| 115 | <td class="data"> </td> |
---|
| 116 | <td colspan="2"> |
---|
| 117 | Set style for following legs to cylindrical polar data</td> |
---|
[ec812baa] | 118 | <td class="version">≥8</td> |
---|
[618b01f] | 119 | </tr> |
---|
[dec6b10] | 120 | <tr> |
---|
| 121 | <td class="code">0x04</td> |
---|
| 122 | <td class="type">STYLE_NOSURVEY</td> |
---|
| 123 | <td class="data"> </td> |
---|
| 124 | <td colspan="2"> |
---|
| 125 | Set style for following legs to unsurveyed</td> |
---|
| 126 | <td class="version">≥8</td> |
---|
| 127 | </tr> |
---|
| 128 | <tr class="reserved"> |
---|
| 129 | <td class="code">0x05 - 0x0e</td> |
---|
| 130 | <td class="type"> </td> |
---|
| 131 | <td class="data"> </td> |
---|
| 132 | <td class="desc" colspan="3">Reserved</td> |
---|
| 133 | </tr> |
---|
[618b01f] | 134 | <tr> |
---|
| 135 | <td class="code">0x0f</td> |
---|
| 136 | <td class="type">MOVE</td> |
---|
| 137 | <td class="data"><x> <y> <z></td> |
---|
| 138 | <td class="desc" colspan="2"> |
---|
| 139 | Set current position to the coordinates given. Coordinates |
---|
| 140 | are 4 byte little-endian signed integers representing |
---|
| 141 | values in centimetres (0.01 metres).</td> |
---|
[ec812baa] | 142 | <td class="version">≥8</td> |
---|
[618b01f] | 143 | </tr> |
---|
[22114ef] | 144 | <tr> |
---|
| 145 | <td class="code">0x10</td> |
---|
| 146 | <td class="type">DATE</td> |
---|
[618b01f] | 147 | <td class="data"> </td> |
---|
[22114ef] | 148 | <td colspan="2"> |
---|
| 149 | No survey date information was specified.</td> |
---|
| 150 | <td class="version">≥8</td> |
---|
[618b01f] | 151 | </tr> |
---|
| 152 | <tr> |
---|
[22114ef] | 153 | <td class="code">0x11</td> |
---|
[618b01f] | 154 | <td class="type">DATE</td> |
---|
[1ee204e] | 155 | <td class="data"><date></td> |
---|
| 156 | <td colspan="2"> |
---|
[0cf46f5] | 157 | Set survey date of legs: date is a 2 byte little-endian unsigned integer |
---|
[22114ef] | 158 | counting days from the start of 1900.</td> |
---|
[ec812baa] | 159 | <td class="version">≥8</td> |
---|
[1ee204e] | 160 | </tr> |
---|
| 161 | <tr> |
---|
[22114ef] | 162 | <td class="code">0x12</td> |
---|
[1ee204e] | 163 | <td class="type">DATE</td> |
---|
| 164 | <td class="data"><date1><datespan></td> |
---|
| 165 | <td colspan="2"> |
---|
[0cf46f5] | 166 | Set survey date of legs to a range: date1 is a |
---|
| 167 | 2 byte little-endian unsigned integer counting days since the start of |
---|
| 168 | 1900, and datespan is an unsigned byte counting days from date1.</td> |
---|
[ec812baa] | 169 | <td class="version">≥8</td> |
---|
[618b01f] | 170 | </tr> |
---|
[1599605] | 171 | <tr> |
---|
[22114ef] | 172 | <td class="code">0x13</td> |
---|
[1ee204e] | 173 | <td class="type">DATE</td> |
---|
| 174 | <td class="data"><date1><date2></td> |
---|
| 175 | <td colspan="2"> |
---|
[0cf46f5] | 176 | Set survey date of legs to a range: date1, date2 are |
---|
| 177 | 2 byte little-endian unsigned integers counting days since the |
---|
| 178 | start of 1900.</td> |
---|
[ec812baa] | 179 | <td class="version">≥8</td> |
---|
[1ee204e] | 180 | </tr> |
---|
[22114ef] | 181 | <tr class="reserved"> |
---|
| 182 | <td class="code">0x14 - 0x1e</td> |
---|
| 183 | <td class="type"> </td> |
---|
[1ee204e] | 184 | <td class="data"> </td> |
---|
[22114ef] | 185 | <td colspan="3">Reserved</td> |
---|
| 186 | </tr> |
---|
| 187 | <tr> |
---|
| 188 | <td class="code">0x1f</td> |
---|
| 189 | <td class="type">ERROR</td> |
---|
| 190 | <td class="data"><legs><length><E><H><V></td> |
---|
[1ee204e] | 191 | <td colspan="2"> |
---|
[22114ef] | 192 | Error information for the current traverse. <legs> is the number of |
---|
| 193 | legs. <length> is the total length of the |
---|
| 194 | traverse in cm (0.01m). E, H and V are the error and the horizontal and |
---|
| 195 | vertical components in cm. (All values are 4 byte little-endian signed integers) </td> |
---|
[ec812baa] | 196 | <td class="version">≥8</td> |
---|
[1ee204e] | 197 | </tr> |
---|
[618b01f] | 198 | <tr class="reserved"> |
---|
[22114ef] | 199 | <td class="code">0x20 - 0x2f</td> |
---|
[618b01f] | 200 | <td class="type"> </td> |
---|
| 201 | <td class="data"> </td> |
---|
| 202 | <td colspan="3">Reserved</td> |
---|
| 203 | </tr> |
---|
| 204 | <tr> |
---|
| 205 | <td class="code" rowspan="3">0x30 - 0x31</td> |
---|
| 206 | <td class="type" rowspan="3">XSECT</td> |
---|
[dec6b10] | 207 | <td class="data" rowspan="3"><label> <L> <R> <U> <D></td> |
---|
[618b01f] | 208 | <td colspan="2"> |
---|
| 209 | Dimensions are 2 byte little-endian signed integers representing values |
---|
| 210 | in centimetres (0.01 metres). Omitted dimensions are encoded as 0xffff. |
---|
| 211 | Station flags are (N & 0x01): </td> |
---|
[ec812baa] | 212 | <td class="version" rowspan="3">≥8</td> |
---|
[618b01f] | 213 | </tr> |
---|
| 214 | <tr> |
---|
| 215 | <th>Flag (N & 0x01)</th> |
---|
| 216 | <th>Meaning</th> |
---|
| 217 | </tr> |
---|
| 218 | <tr> |
---|
| 219 | <td>0x01</td> |
---|
| 220 | <td>Station is last one in this passage</td> |
---|
| 221 | </tr> |
---|
| 222 | <tr> |
---|
| 223 | <td class="code" rowspan="3">0x32 - 0x33</td> |
---|
| 224 | <td class="type" rowspan="3">XSECT</td> |
---|
[dec6b10] | 225 | <td class="data" rowspan="3"><label> <L> <R> <U> <D></td> |
---|
[618b01f] | 226 | <td colspan="2"> |
---|
| 227 | Dimensions are 4 byte little-endian signed integers representing values |
---|
| 228 | in centimetres (0.01 metres). Omitted dimensions are encoded as |
---|
| 229 | 0xffffffff.</td> |
---|
[ec812baa] | 230 | <td class="version" rowspan="3">≥8</td> |
---|
[618b01f] | 231 | </tr> |
---|
| 232 | <tr> |
---|
| 233 | <th>Flag (N & 0x01)</th> |
---|
| 234 | <th>Meaning</th> |
---|
| 235 | </tr> |
---|
| 236 | <tr> |
---|
| 237 | <td>0x01</td> |
---|
| 238 | <td>Station is last one in this passage</td> |
---|
| 239 | </tr> |
---|
| 240 | <tr class="reserved"> |
---|
| 241 | <td class="code">0x34 - 0x3f</td> |
---|
| 242 | <td class="type"> </td> |
---|
| 243 | <td class="data"> </td> |
---|
| 244 | <td colspan="3">Reserved</td> |
---|
| 245 | </tr> |
---|
| 246 | <!-- Checked to here! --> |
---|
| 247 | <tr> |
---|
[dec6b10] | 248 | <td class="code" rowspan="8">0x40 - 0x7f</td> |
---|
| 249 | <td class="type" rowspan="8">LINE</td> |
---|
| 250 | <td class="data" rowspan="8"><label> <x> <y> <z></td> |
---|
| 251 | <td colspan="2"> |
---|
| 252 | Append label to the current label buffer. The length of the label is |
---|
| 253 | encoded as for a station label below. Return leg from current position |
---|
| 254 | to coordinates given, and update current position to coordinates given. |
---|
| 255 | The updated contents of the label buffer give the survey that the leg is |
---|
| 256 | in.</td> |
---|
| 257 | <td class="version" rowspan="5">≥8</td> |
---|
| 258 | </tr> |
---|
| 259 | <tr> |
---|
| 260 | <th>Flag (N & 0x3f)</th> |
---|
| 261 | <th>Meaning</th> |
---|
| 262 | </tr> |
---|
| 263 | <tr> |
---|
| 264 | <td>0x01</td> |
---|
| 265 | <td>Leg is above ground</td> |
---|
| 266 | </tr> |
---|
| 267 | <tr> |
---|
| 268 | <td>0x02</td> |
---|
| 269 | <td>Leg duplicates data in another leg (e.g. resurvey along a passage to |
---|
| 270 | tie into a known station)</td> |
---|
| 271 | </tr> |
---|
| 272 | <tr> |
---|
| 273 | <td>0x04</td> |
---|
| 274 | <td>Leg is a splay shot in a chamber (radial shots from a central point)</td> |
---|
| 275 | </tr> |
---|
| 276 | <tr class="reserved"> |
---|
| 277 | <td>0x08</td> |
---|
| 278 | <td colspan="2">Reserved</td> |
---|
| 279 | </tr> |
---|
| 280 | <tr class="reserved"> |
---|
| 281 | <td>0x10</td> |
---|
| 282 | <td colspan="2">Reserved</td> |
---|
| 283 | </tr> |
---|
[e133186] | 284 | <tr> |
---|
[dec6b10] | 285 | <td>0x20</td> |
---|
[e133186] | 286 | <td>No change to label (<label> omitted entirely)</td> |
---|
| 287 | <td class="version">≥8</td> |
---|
[dec6b10] | 288 | </tr> |
---|
| 289 | <tr> |
---|
| 290 | <td class="code" rowspan="14">0x80 - 0xff</td> |
---|
| 291 | <td class="type" rowspan="14">LABEL</td> |
---|
| 292 | <td class="data" rowspan="14"><label> <x> <y> <z></td> |
---|
[618b01f] | 293 | <td colspan="2"> |
---|
| 294 | Append label to the current label buffer. The updated contents of the |
---|
| 295 | label buffer give the survey stations full name. The length of label is |
---|
| 296 | given by length, which is encoded as follows:</td> |
---|
[dec6b10] | 297 | <td class="version" rowspan="14">≥8</td> |
---|
[618b01f] | 298 | </tr> |
---|
| 299 | <tr> |
---|
| 300 | <th>Length</th> |
---|
| 301 | <th>Encoding</th> |
---|
| 302 | </tr> |
---|
| 303 | <tr> |
---|
| 304 | <td>0 - 253</td> |
---|
| 305 | <td>byte 0x00 - 0xfd</td> |
---|
| 306 | </tr> |
---|
| 307 | <tr> |
---|
| 308 | <td>254-65789</td> |
---|
| 309 | <td>byte 0xfe 2 byte little-endian unsigned integer len-254 0x0000-0xffff</td> |
---|
| 310 | </tr> |
---|
| 311 | <tr> |
---|
| 312 | <td>65790 and greater</td> |
---|
| 313 | <td>byte 0xff 4 byte little-endian unsigned integer len |
---|
| 314 | 0x000100fd-0xffffffff</td> |
---|
| 315 | </tr> |
---|
| 316 | <tr> |
---|
| 317 | <td colspan="2"> |
---|
[dec6b10] | 318 | The station flags are encoded in the bottom 7 bits of the item code:</td> |
---|
[618b01f] | 319 | </tr> |
---|
| 320 | <tr> |
---|
[dec6b10] | 321 | <th>Flag (N & 0x7f)</th> |
---|
[618b01f] | 322 | <th>Meaning</th> |
---|
| 323 | </tr> |
---|
| 324 | <tr> |
---|
| 325 | <td>0x01</td> |
---|
| 326 | <td>Station is on leg above ground</td> |
---|
| 327 | </tr> |
---|
| 328 | <tr> |
---|
| 329 | <td>0x02</td> |
---|
| 330 | <td>Station is on an underground leg (both may be true at an entrance)</td> |
---|
| 331 | </tr> |
---|
| 332 | <tr> |
---|
| 333 | <td>0x04</td> |
---|
| 334 | <td>Station is marked as an entrance (with *entrance)</td> |
---|
| 335 | </tr> |
---|
| 336 | <tr> |
---|
| 337 | <td>0x08</td> |
---|
| 338 | <td>Station is exported (i.e. may be used as a connection point to other |
---|
| 339 | surveys)</td> |
---|
| 340 | </tr> |
---|
| 341 | <tr> |
---|
| 342 | <td>0x10</td> |
---|
| 343 | <td>Station is a fixed point (control point)</td> |
---|
| 344 | </tr> |
---|
| 345 | <tr> |
---|
| 346 | <td>0x20</td> |
---|
[dec6b10] | 347 | <td>Station is anonymous</td> |
---|
[618b01f] | 348 | </tr> |
---|
[dec6b10] | 349 | <tr> |
---|
| 350 | <td>0x40</td> |
---|
| 351 | <td>Station is on the passage wall</td> |
---|
[618b01f] | 352 | </tr> |
---|
| 353 | </table> |
---|
[e77d6de] | 354 | |
---|
[618b01f] | 355 | <H2>Item order</H2> |
---|
[2d82f2a] | 356 | <ul> |
---|
[618b01f] | 357 | <li>A continuous section of centreline is defined by a <MOVE> item, followed |
---|
| 358 | by one or more <LINE> items.</li> |
---|
| 359 | <li><LABEL> items may appear anywhere in the file after the header, |
---|
| 360 | including within a <MOVE><LINE>... sequence.</li> |
---|
| 361 | <li>Duplicate <LABEL> items are permitted provided they also have identical |
---|
| 362 | coordinate values. (The same coordinate values may also be shared by any |
---|
| 363 | number of different <LABEL> items).</li> |
---|
| 364 | <li>Stations must be defined in a <LABEL> item <u>before</u> being |
---|
| 365 | referenced (e.g. in <XSECT> items)</li> |
---|
[2d82f2a] | 366 | </ul> |
---|
| 367 | |
---|
[17ec06d] | 368 | <P>Authors: Olly Betts and Mike McCombe, last updated: 2014-07-02</P> |
---|
[2d82f2a] | 369 | </BODY></HTML> |
---|