source: git/trunk/doc/3dformat.htm @ 7bb8184

Last change on this file since 7bb8184 was 7bb8184, checked in by Olly Betts <olly@…>, 13 years ago

Retagging 1.2.0

git-svn-id: file:///home/survex-svn/survex/tags/1.2.0@3664 4b37db11-9a0c-4f06-9ece-9ab7cdaee568

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