source: git/doc/3dformat.htm @ 43d63e57

RELEASE/1.2debug-cidebug-ci-sanitisersfaster-cavernloglog-selectstereostereo-2025walls-datawalls-data-hanging-as-warningwarn-only-for-hanging-survey
Last change on this file since 43d63e57 was 22114ef, checked in by Olly Betts <olly@…>, 12 years ago

doc/3dformat.htm,src/img.c: Move the DATE and ERROR codes in 3d v8 to
leave a large contiguous block of codes available.

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