Prev Up Top Next Contents

2.B Data syntax

The therion data syntax is thoroughly explained in the Therion book [thbook 10-11].
The therion data files are text files, with lines of commands (with arguments and options), lines of data, and lines of comments (these begin with a character '#'). The commands can be single-line or multiline. In this case there is a termination command, that is a command with the name made by prefixing the command name with "end". For example the command centerline is terminated by the command endcenterline.
The data lines can contain numerical values or options for the command. In the case of options this applies to the data that follow.
The character '#' marks the beginning of a comment. Inline comments are allowed: everything that follows a '#' up to the end of the line is treated as comment (and ignored). The backslash character 'at the end of a line denotes continuation on the following line as if they were a single line Arguments and options with spaces must be enclosed in double quotes '"', if they are character strings, or square brackets '[' ']', for numerical values. For example the value of a RGB color is composed by three numbers (between 0 and 100) and is written in square brackets: for instance [100 0 0] is the red color.
The keywords may contain the letters of the alphabeth, digits, underscore '_', minus sign '-', and slash '/'. Words can contain also plus sign '+', star '*', comma ',', period '.', and single quotation "'". To use a keyword as value in a data line you must prefix (escape) it with an exclamation mark '!'.
The format of the dates is yyyy.mm.dd$hh:mm:ss.ss. A time interval is composed by two dates joined by a dash (minus sign '-'). The name of a person is made of two strings separated by a space, ie, "name surname". Only one space is allowed. If the name has more than one space use slash '/' in place of the first space. Among the units there are meter centimeter (also m and cm), degree (deg) and percent.

2.B.1 therion commands

therion commands have a context, ie, a command must occur inside another which is its context. The following figure shows the hierarchy of contexts: the contexts of the commands are shown as arrows.


Contexts
Fig. 28. Contexts

encoding type.
This command defines the encoding used to write the data that follows. For example encoding UTF-8 or encoding ASCII.

input file.
This command tells therion to read in another file. If the filename contains a directory separator you should use the slash '/' for better portability. It is good practice to avoid absolute names.

survey name.
This command defines a level in the namespace of the surveys. The name of the level is the argument to the command (the name of the survey). Among the option there are declination (to specify the value of the magnetic declination correction that must be applied to the data) and title, that defines the title of the survey.
The entrance option is used to specify the main entrance to the cave, in case there are several entrances. For example, "-entrance station_01", where "station_01" is the name of the entrance station. The entrance is used in the list export.

centerline or centreline.
This command defines the start of survey data. It has sevral options:

The command infer plumbs on specifies that the shots +/- 90 must not be corrected in inclination. The command infer equates on states that shots of length 0 must be treated as an equate command (no error correction).

Currently supported coordinate systems are "UTM", "long-lat", "lat-long", czechoslovak "JTSK" and "iJTSK", and ESRI and EPGS codes. Coordinate systems are internally specified in PROJ4 library format, http://proj.maptools.org . Briefly this is a string with keyowrd prefixed by plus sign and separated by the value by the equal sign. For example,
  +proj=latlong +datum=wgs84 +pm=rome
Other keywords are the ellipsoid (+ellps), the false origin parameters (+lat_0, +lon_0, +x_0, +y_0), the scale (+k), and the units (+units).
Coordinate system can be specified also in the surface and layout commands, as well as in the configuration file (for the output). By default the coordinate system is "local", ie, therion assumes that you are working with a local coordinate system. The data entered are interpreted as in the defined coordinate system. For example
  cs long-lat
  fix 1 19:20 34:30 1500
means fixing point 1 at E19deg20min, N34deg30min altitude (above sea level) 1500 [m].

scrap.
A scrap encloses a portion of cave map that contains no overlapping passages. It usually cover about hundred meters of cave passages. It contains points (symbols and texts), lines, and areas. The contour of the scrap is formed by lines with the option -outline. This can be "out", "in" or "none". Lines of type "wall" have -outline out by default. Other lines have -outline none by default. The lines of the contour must not intersect, otherwise MetaPost gives a warning message (therion sees the message but continues). It is good practice to check for these messages and fix them anyways.
A scrap must have two stations that provide its reference frame. If it has only one station (or none), as is the case for most cross-sections, it must have the option -scale. The scrap options are

point x y type.
This command defines a point in the drawing, giving its coordinates and its type. Most of the cave symbols are associated with types of points. Text labels are also point objects. There are also points that do not have a representation on the drawing (for instance points that define the dimensions of the passage). The types of points are
Certain types of points can have options:

line type.
The "line" command, like the "point" command, has a type: wall, contour, slope, ... or it can be a filling, a label, or a special line type (border, arrow, section, survey).
The difference between "gradient" and "slope" is that the first draws a single arrow (in the direction of the line), while the second drawn several ticks (in directions roughly orthogonal to the line) [thmail 2006-05-05].
The "line" command can have options:

area.
An area is defined by the lines that make its contour. These can be of any type, but they must be listed in order, and intersect each-other consecutively. The simplest way to ensure that this is the case is to draw a closed line and use only that for the contour of the area. However this is often not possible.
The "area" command has a type (the type of the area):
The "area" command can have options:

join.
The "join" command connects two scraps, or a set of two or more points of the map. It is advisable to put the joins in places where the cave is simple (a passage with no features), otherwise you must put "join" commands for any object. There are two syntaxes of "join":
join point1 point2 ... pointN
join scrap1 scrap2
In the first case you join points and/or line points. The point name used in the "join" command must be id of scrap points ("point" command) or line-points (point belonging to a "line" command). In the latter case the id is the line-id followed by the point index; for example "my_line:2" denotes the third point on the line "my_line" (point indices start from 0). "my_line:end" is the final point of the line "my_line". Depending where the join command is the point name and line name might need to be completed with the survey path, eg, "my_line@subsurvey1.survey2:0".
Examples of "join" are in chapter 3 .
In the second case you join two scraps. Only the lines of type "wall" are joined. To continue a graphical element beyond the outline of the scrap it belongs to, it must have the option "-clip off".
join has two options:
The join command do not chain. Therefore you cannot type
join a b join b c
and have "a", "b", "c" all coincide. You must type
join a b c

equate.
Identifies two (or more) station names. See survex for more details.

map.
A map is acollection of scraps or maps (cannot mix them together). It can include a survey (the centerline will be displayed with the map). This command specifies as assemble of scraps (or maps) and surveys. The "map" command is multiline,
   map id [opzioni]
      <ids of scraps or maps>     <--- level 0
      break
      <ids of scraps or maps>     <--- level 1
      preview <above|below> another_map
   endmap
The break command splits the map on different levels. It is not possible to mix together ids of scraps and ids of maps: only one type can be used. The map is drawn in the output starting with the lowest level, therefore the scrap at level "1" are covered by those at level "0". The preview command includes the outline of another map.
The select option -map-level N specifies the levels up to which elements of the map are included in the export. The "normal" elements of the selected map are at level 0. Each element with on offset is on a lavel one step higher. In the following example map "m12" is at level 1 of map "m", therefore map "m2" is at level 2 of map "m". With "select m -map-level 1" only map "m2" is displayed with an offset.
  map m1 ...
  endmap

  ...

  map m12 ...
    m1                 # this is at level 0 with respect to m12
    m2 [10 10 m] above # this is at level 1 in m12
  endmap

  map m ...
    m3 
    m12 [10 10 m] above
  endmap
The map elements with a preview are displayed only if they are at level 0.
The map command has options:

surface.
This is a multiline command, used to include surface topography data. These can be given as a bitmap file, or as grid of altitudes. Therefore there are two possible syntaxes. In the first case you must provide the filename and its relation to the cave map,
   surface
     bitmap file_name calibration
   endsurface
where the calibration connects two points in the file (expressed as X-Y pairs in pixel units, with the origin (0,0) at the lower-left corner) to two points in the drawing, expressed as x-y in meters, or as station names. Therefore the syntax is
    X1 Y1 x1 y1 X2 Y2 x2 y2
\br
    X1 Y1 station_1 X2 Y2 station_2
In the second case you must specify parameters of the grid and provide its data,
   surface
      grid-units units
      grid origin_x origin_y step_x step_y size_x size_y
      grid-flip [none|vertical|horizontal]
      data_of_the_grid
   endsurface
In this case the origin is the lower-left corner of the grid. The step is the dimension of the grid-cells, and the size is the number of grid nodes on the rows (x) and on the columns (y). The grid data are the altitudes (above sea level, in meters) at the nodes of the grid. They must be written by rows (from the west to the east), scanning the rows from the bottom (south) to the top (north).

import.
This command is used to import survey data in an external format, "3d", "plt" or "xyz".

grade.
This command defines the grade, ie, the accuracy, of the survey. For example the option grade N in the centerline, specifies the BCRA grade of the survey. Here N anges from 0 to 7. Grade 0 refers to data with no quality, ie data that nobody can locate now. Grade 7 is grade BCRA X.
The sd option of data overcomes the general grade specification.
The following is a table of accuracies (at 2 std, ie, 95 % confidence) for the position grades.
grade position error altitude error comment
0    td position unknown
1 1000 m 1000 m rough estimate, by memory
2 100 m 100 m GPS in bad conditions
3 15 m 45 m GPS with large-scale map
4 5 m 15 m GPS with long observation
5 1 m 3 m GIS GPS
6 15 cm 15 cm geodetic GPS, theodolite, technical
7 5 cm 5 cm geodetic GPS, precise theodolite
TODO an example and explain more.

revise.
This command is used to redefine properties of an object. It can ebe single-line, eg, "revise id -option1 value1 -option2 value2 ..." or multiline, terminated by the command endrevise.
TODO an example and explain more.

2.B.2 The examples

Data names
The join count option

therion users - Tue Dec 14 17:07:14 2010
Prev Up Top Next Contents

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.