source: git/doc/3dformat.htm @ 88f302c

debug-cidebug-ci-sanitisersfaster-cavernloglog-selectstereo-2025walls-datawalls-data-hanging-as-warningwarn-only-for-hanging-survey
Last change on this file since 88f302c was cf62988, checked in by Olly Betts <olly@…>, 4 years ago

Require at least PROJ 5.0

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