[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. |
---|
| 50 | <li> Survey title: A string followed by a linefeed. There's no length limit on |
---|
| 51 | this string. |
---|
| 52 | <li> Timestamp: A string consisting of an '@' followed by a count of |
---|
| 53 | seconds since the start of 1970 in UTC ("Unix time_t") as a string |
---|
| 54 | (for example: "@1371300355"), followed by a linefeed. This is intended to be |
---|
| 55 | the time the file was generated, rather than the time the survey data was |
---|
| 56 | collected. |
---|
[73fea40] | 57 | <li> File-wide flags: a single byte. If bit 7 is set, this is an extended |
---|
| 58 | elevation. All other bits are reserved - set them to 0 when writing, and |
---|
| 59 | ignore them when reading. |
---|
[2d82f2a] | 60 | </ul> |
---|
| 61 | |
---|
| 62 | <H2>Items</H2> |
---|
| 63 | |
---|
| 64 | <P>Following the header are a number of items. The last item must be a 0x00 |
---|
| 65 | byte when the current label is empty, which marks the end of the data. The |
---|
[618b01f] | 66 | first byte of an item is a code identifying what the item is:</P> |
---|
[760a6550] | 67 | |
---|
[618b01f] | 68 | <table border="1" cellpadding="1" cellspacing="0" width="100%"> |
---|
| 69 | <tr> |
---|
| 70 | <th class="code">Code</th> |
---|
| 71 | <th class="code">Type</th> |
---|
| 72 | <th class="data">Data</th> |
---|
| 73 | <th class="desc" colspan="2">Meaning</th> |
---|
| 74 | <th class="version">Version</th> |
---|
| 75 | </tr> |
---|
| 76 | <tr> |
---|
| 77 | <td class="code">0x00</td> |
---|
[dec6b10] | 78 | <td class="type">STYLE_NORMAL / STOP</td> |
---|
[618b01f] | 79 | <td class="data"> </td> |
---|
[dec6b10] | 80 | <td colspan="2"> |
---|
| 81 | Set style for following legs to tape, compass and clino. |
---|
| 82 | <p> |
---|
| 83 | If the style is already set to STYLE_NORMAL, this code signifies the |
---|
| 84 | end of the data in the 3d file.</td> |
---|
[ec812baa] | 85 | <td class="version">≥8</td> |
---|
[618b01f] | 86 | </tr> |
---|
| 87 | <tr> |
---|
[dec6b10] | 88 | <td class="code">0x01</td> |
---|
| 89 | <td class="type">STYLE_DIVING</td> |
---|
[618b01f] | 90 | <td class="data"> </td> |
---|
[dec6b10] | 91 | <td colspan="2"> |
---|
| 92 | Set style for following legs to diving data</td> |
---|
| 93 | <td class="version">≥8</td> |
---|
| 94 | </tr> |
---|
| 95 | <tr> |
---|
| 96 | <td class="code">0x02</td> |
---|
| 97 | <td class="type">STYLE_CARTESIAN</td> |
---|
| 98 | <td class="data"> </td> |
---|
| 99 | <td colspan="2"> |
---|
| 100 | Set style for following legs to cartesian data</td> |
---|
| 101 | <td class="version">≥8</td> |
---|
| 102 | </tr> |
---|
| 103 | <tr> |
---|
| 104 | <td class="code">0x03</td> |
---|
| 105 | <td class="type">STYLE_CYLPOLAR</td> |
---|
| 106 | <td class="data"> </td> |
---|
| 107 | <td colspan="2"> |
---|
| 108 | Set style for following legs to cylindrical polar data</td> |
---|
[ec812baa] | 109 | <td class="version">≥8</td> |
---|
[618b01f] | 110 | </tr> |
---|
[dec6b10] | 111 | <tr> |
---|
| 112 | <td class="code">0x04</td> |
---|
| 113 | <td class="type">STYLE_NOSURVEY</td> |
---|
| 114 | <td class="data"> </td> |
---|
| 115 | <td colspan="2"> |
---|
| 116 | Set style for following legs to unsurveyed</td> |
---|
| 117 | <td class="version">≥8</td> |
---|
| 118 | </tr> |
---|
| 119 | <tr class="reserved"> |
---|
| 120 | <td class="code">0x05 - 0x0e</td> |
---|
| 121 | <td class="type"> </td> |
---|
| 122 | <td class="data"> </td> |
---|
| 123 | <td class="desc" colspan="3">Reserved</td> |
---|
| 124 | </tr> |
---|
[618b01f] | 125 | <tr> |
---|
| 126 | <td class="code">0x0f</td> |
---|
| 127 | <td class="type">MOVE</td> |
---|
| 128 | <td class="data"><x> <y> <z></td> |
---|
| 129 | <td class="desc" colspan="2"> |
---|
| 130 | Set current position to the coordinates given. Coordinates |
---|
| 131 | are 4 byte little-endian signed integers representing |
---|
| 132 | values in centimetres (0.01 metres).</td> |
---|
[ec812baa] | 133 | <td class="version">≥8</td> |
---|
[618b01f] | 134 | </tr> |
---|
[dec6b10] | 135 | <tr class="reserved"> |
---|
[618b01f] | 136 | <td class="code">0x10 - 0x1f</td> |
---|
[dec6b10] | 137 | <td class="type"> </td> |
---|
[618b01f] | 138 | <td class="data"> </td> |
---|
[dec6b10] | 139 | <td colspan="3">Reserved</td> |
---|
[618b01f] | 140 | </tr> |
---|
| 141 | <tr> |
---|
[1ee204e] | 142 | <td class="code">0x20</td> |
---|
[618b01f] | 143 | <td class="type">DATE</td> |
---|
[1ee204e] | 144 | <td class="data"><date></td> |
---|
| 145 | <td colspan="2"> |
---|
[0cf46f5] | 146 | Set survey date of legs: date is a 2 byte little-endian unsigned integer |
---|
| 147 | counting days from the |
---|
| 148 | start of 1900.</td> |
---|
[ec812baa] | 149 | <td class="version">≥8</td> |
---|
[1ee204e] | 150 | </tr> |
---|
| 151 | <tr> |
---|
| 152 | <td class="code">0x21</td> |
---|
| 153 | <td class="type">DATE</td> |
---|
| 154 | <td class="data"><date1><datespan></td> |
---|
| 155 | <td colspan="2"> |
---|
[0cf46f5] | 156 | Set survey date of legs to a range: date1 is a |
---|
| 157 | 2 byte little-endian unsigned integer counting days since the start of |
---|
| 158 | 1900, and datespan is an unsigned byte counting days from date1.</td> |
---|
[ec812baa] | 159 | <td class="version">≥8</td> |
---|
[618b01f] | 160 | </tr> |
---|
[1599605] | 161 | <tr> |
---|
| 162 | <td class="code">0x22</td> |
---|
| 163 | <td class="type">ERROR</td> |
---|
| 164 | <td class="data"><legs><length><E><H><V></td> |
---|
| 165 | <td colspan="2"> |
---|
[0cf46f5] | 166 | Error information for the current traverse. <legs> is the number of |
---|
| 167 | legs. <length> is the total length of the |
---|
| 168 | traverse in cm (0.01m). E, H and V are the error and the horizontal and |
---|
| 169 | vertical components in cm. (All values are 4 byte little-endian signed integers) </td> |
---|
[ec812baa] | 170 | <td class="version">≥8</td> |
---|
[1599605] | 171 | </tr> |
---|
[1ee204e] | 172 | <tr> |
---|
| 173 | <td class="code">0x23</td> |
---|
| 174 | <td class="type">DATE</td> |
---|
| 175 | <td class="data"><date1><date2></td> |
---|
| 176 | <td colspan="2"> |
---|
[0cf46f5] | 177 | Set survey date of legs to a range: date1, date2 are |
---|
| 178 | 2 byte little-endian unsigned integers counting days since the |
---|
| 179 | start of 1900.</td> |
---|
[ec812baa] | 180 | <td class="version">≥8</td> |
---|
[1ee204e] | 181 | </tr> |
---|
| 182 | <tr> |
---|
| 183 | <td class="code">0x24</td> |
---|
| 184 | <td class="type">DATE</td> |
---|
| 185 | <td class="data"> </td> |
---|
| 186 | <td colspan="2"> |
---|
[0cf46f5] | 187 | No survey date information was specified.</td> |
---|
[ec812baa] | 188 | <td class="version">≥8</td> |
---|
[1ee204e] | 189 | </tr> |
---|
[618b01f] | 190 | <tr class="reserved"> |
---|
[1ee204e] | 191 | <td class="code">0x25 - 0x2f</td> |
---|
[618b01f] | 192 | <td class="type"> </td> |
---|
| 193 | <td class="data"> </td> |
---|
| 194 | <td colspan="3">Reserved</td> |
---|
| 195 | </tr> |
---|
| 196 | <tr> |
---|
| 197 | <td class="code" rowspan="3">0x30 - 0x31</td> |
---|
| 198 | <td class="type" rowspan="3">XSECT</td> |
---|
[dec6b10] | 199 | <td class="data" rowspan="3"><label> <L> <R> <U> <D></td> |
---|
[618b01f] | 200 | <td colspan="2"> |
---|
| 201 | Dimensions are 2 byte little-endian signed integers representing values |
---|
| 202 | in centimetres (0.01 metres). Omitted dimensions are encoded as 0xffff. |
---|
| 203 | Station flags are (N & 0x01): </td> |
---|
[ec812baa] | 204 | <td class="version" rowspan="3">≥8</td> |
---|
[618b01f] | 205 | </tr> |
---|
| 206 | <tr> |
---|
| 207 | <th>Flag (N & 0x01)</th> |
---|
| 208 | <th>Meaning</th> |
---|
| 209 | </tr> |
---|
| 210 | <tr> |
---|
| 211 | <td>0x01</td> |
---|
| 212 | <td>Station is last one in this passage</td> |
---|
| 213 | </tr> |
---|
| 214 | <tr> |
---|
| 215 | <td class="code" rowspan="3">0x32 - 0x33</td> |
---|
| 216 | <td class="type" rowspan="3">XSECT</td> |
---|
[dec6b10] | 217 | <td class="data" rowspan="3"><label> <L> <R> <U> <D></td> |
---|
[618b01f] | 218 | <td colspan="2"> |
---|
| 219 | Dimensions are 4 byte little-endian signed integers representing values |
---|
| 220 | in centimetres (0.01 metres). Omitted dimensions are encoded as |
---|
| 221 | 0xffffffff.</td> |
---|
[ec812baa] | 222 | <td class="version" rowspan="3">≥8</td> |
---|
[618b01f] | 223 | </tr> |
---|
| 224 | <tr> |
---|
| 225 | <th>Flag (N & 0x01)</th> |
---|
| 226 | <th>Meaning</th> |
---|
| 227 | </tr> |
---|
| 228 | <tr> |
---|
| 229 | <td>0x01</td> |
---|
| 230 | <td>Station is last one in this passage</td> |
---|
| 231 | </tr> |
---|
| 232 | <tr class="reserved"> |
---|
| 233 | <td class="code">0x34 - 0x3f</td> |
---|
| 234 | <td class="type"> </td> |
---|
| 235 | <td class="data"> </td> |
---|
| 236 | <td colspan="3">Reserved</td> |
---|
| 237 | </tr> |
---|
| 238 | <!-- Checked to here! --> |
---|
| 239 | <tr> |
---|
[dec6b10] | 240 | <td class="code" rowspan="8">0x40 - 0x7f</td> |
---|
| 241 | <td class="type" rowspan="8">LINE</td> |
---|
| 242 | <td class="data" rowspan="8"><label> <x> <y> <z></td> |
---|
| 243 | <td colspan="2"> |
---|
| 244 | Append label to the current label buffer. The length of the label is |
---|
| 245 | encoded as for a station label below. Return leg from current position |
---|
| 246 | to coordinates given, and update current position to coordinates given. |
---|
| 247 | The updated contents of the label buffer give the survey that the leg is |
---|
| 248 | in.</td> |
---|
| 249 | <td class="version" rowspan="5">≥8</td> |
---|
| 250 | </tr> |
---|
| 251 | <tr> |
---|
| 252 | <th>Flag (N & 0x3f)</th> |
---|
| 253 | <th>Meaning</th> |
---|
| 254 | </tr> |
---|
| 255 | <tr> |
---|
| 256 | <td>0x01</td> |
---|
| 257 | <td>Leg is above ground</td> |
---|
| 258 | </tr> |
---|
| 259 | <tr> |
---|
| 260 | <td>0x02</td> |
---|
| 261 | <td>Leg duplicates data in another leg (e.g. resurvey along a passage to |
---|
| 262 | tie into a known station)</td> |
---|
| 263 | </tr> |
---|
| 264 | <tr> |
---|
| 265 | <td>0x04</td> |
---|
| 266 | <td>Leg is a splay shot in a chamber (radial shots from a central point)</td> |
---|
| 267 | </tr> |
---|
| 268 | <tr class="reserved"> |
---|
| 269 | <td>0x08</td> |
---|
| 270 | <td colspan="2">Reserved</td> |
---|
| 271 | </tr> |
---|
| 272 | <tr class="reserved"> |
---|
| 273 | <td>0x10</td> |
---|
| 274 | <td colspan="2">Reserved</td> |
---|
| 275 | </tr> |
---|
[e133186] | 276 | <tr> |
---|
[dec6b10] | 277 | <td>0x20</td> |
---|
[e133186] | 278 | <td>No change to label (<label> omitted entirely)</td> |
---|
| 279 | <td class="version">≥8</td> |
---|
[dec6b10] | 280 | </tr> |
---|
| 281 | <tr> |
---|
| 282 | <td class="code" rowspan="14">0x80 - 0xff</td> |
---|
| 283 | <td class="type" rowspan="14">LABEL</td> |
---|
| 284 | <td class="data" rowspan="14"><label> <x> <y> <z></td> |
---|
[618b01f] | 285 | <td colspan="2"> |
---|
| 286 | Append label to the current label buffer. The updated contents of the |
---|
| 287 | label buffer give the survey stations full name. The length of label is |
---|
| 288 | given by length, which is encoded as follows:</td> |
---|
[dec6b10] | 289 | <td class="version" rowspan="14">≥8</td> |
---|
[618b01f] | 290 | </tr> |
---|
| 291 | <tr> |
---|
| 292 | <th>Length</th> |
---|
| 293 | <th>Encoding</th> |
---|
| 294 | </tr> |
---|
| 295 | <tr> |
---|
| 296 | <td>0 - 253</td> |
---|
| 297 | <td>byte 0x00 - 0xfd</td> |
---|
| 298 | </tr> |
---|
| 299 | <tr> |
---|
| 300 | <td>254-65789</td> |
---|
| 301 | <td>byte 0xfe 2 byte little-endian unsigned integer len-254 0x0000-0xffff</td> |
---|
| 302 | </tr> |
---|
| 303 | <tr> |
---|
| 304 | <td>65790 and greater</td> |
---|
| 305 | <td>byte 0xff 4 byte little-endian unsigned integer len |
---|
| 306 | 0x000100fd-0xffffffff</td> |
---|
| 307 | </tr> |
---|
| 308 | <tr> |
---|
| 309 | <td colspan="2"> |
---|
[dec6b10] | 310 | The station flags are encoded in the bottom 7 bits of the item code:</td> |
---|
[618b01f] | 311 | </tr> |
---|
| 312 | <tr> |
---|
[dec6b10] | 313 | <th>Flag (N & 0x7f)</th> |
---|
[618b01f] | 314 | <th>Meaning</th> |
---|
| 315 | </tr> |
---|
| 316 | <tr> |
---|
| 317 | <td>0x01</td> |
---|
| 318 | <td>Station is on leg above ground</td> |
---|
| 319 | </tr> |
---|
| 320 | <tr> |
---|
| 321 | <td>0x02</td> |
---|
| 322 | <td>Station is on an underground leg (both may be true at an entrance)</td> |
---|
| 323 | </tr> |
---|
| 324 | <tr> |
---|
| 325 | <td>0x04</td> |
---|
| 326 | <td>Station is marked as an entrance (with *entrance)</td> |
---|
| 327 | </tr> |
---|
| 328 | <tr> |
---|
| 329 | <td>0x08</td> |
---|
| 330 | <td>Station is exported (i.e. may be used as a connection point to other |
---|
| 331 | surveys)</td> |
---|
| 332 | </tr> |
---|
| 333 | <tr> |
---|
| 334 | <td>0x10</td> |
---|
| 335 | <td>Station is a fixed point (control point)</td> |
---|
| 336 | </tr> |
---|
| 337 | <tr> |
---|
| 338 | <td>0x20</td> |
---|
[dec6b10] | 339 | <td>Station is anonymous</td> |
---|
[618b01f] | 340 | </tr> |
---|
[dec6b10] | 341 | <tr> |
---|
| 342 | <td>0x40</td> |
---|
| 343 | <td>Station is on the passage wall</td> |
---|
[618b01f] | 344 | </tr> |
---|
| 345 | </table> |
---|
[e77d6de] | 346 | |
---|
[618b01f] | 347 | <H2>Item order</H2> |
---|
[2d82f2a] | 348 | <ul> |
---|
[618b01f] | 349 | <li>A continuous section of centreline is defined by a <MOVE> item, followed |
---|
| 350 | by one or more <LINE> items.</li> |
---|
| 351 | <li><LABEL> items may appear anywhere in the file after the header, |
---|
| 352 | including within a <MOVE><LINE>... sequence.</li> |
---|
| 353 | <li>Duplicate <LABEL> items are permitted provided they also have identical |
---|
| 354 | coordinate values. (The same coordinate values may also be shared by any |
---|
| 355 | number of different <LABEL> items).</li> |
---|
| 356 | <li>Stations must be defined in a <LABEL> item <u>before</u> being |
---|
| 357 | referenced (e.g. in <XSECT> items)</li> |
---|
[2d82f2a] | 358 | </ul> |
---|
| 359 | |
---|
[dec6b10] | 360 | <P>Authors: Olly Betts and Mike McCombe, last updated: 2013-07-16</P> |
---|
[2d82f2a] | 361 | </BODY></HTML> |
---|