These rules are used in all places where real value formatting is needed (for example, Text format, header files, title files and Point view). There is also dialog for building format definition.
Format definition contains possible degree/minute/second-format and decimal rounding handling. These definitions work for all coordinate values and also for attributes containing numeric values. If the definition starts with character +, sign is written also for positive values. Character = writes the absolute value.
Decimal part starts with point and defines amount of written decimals. By default normal mathematical rounding rules are used, when writing decimals. Rounding characters < and > at the end of definition round down or up, respectively. Negative amount of decimals rounds to the nearest power of ten. Point alone uses converter decimal setting.
Point also forces attribute data to be numeric. Then it is written using normal decimal setting rules and in reading possible decimal separator comma is converted to point. Missing numeric values are written as zeroes by default and reading empty numeric value creates attribute with zero value. Empty values can be skipped by starting the format definition with the character _. Numeric values are then written as empty strings and reading empty values does not create attribute.
Even when attribute values are internally stored as text with constant amount of decimals, their values can still be written with less decimals. When reading data, amount of decimals has no meaning for coordinates: all decimals are always read. Values stored to attributes use amount of decimals from the definition.
Numeric value can be multiplied to percentage value with the character p or per mille value with the character o. Percentage sign can also be appended to the value. With the per mille notation percentage character is automatically converted to per mille character.
Numeric value can be multiplied to percentage with the character p or per mille with the character o. Percentage or per mille sign is automatically appended to the value. With the character q numeric value can be displayed as ratio. Ratio representation depends on the original value being less or greater than one. Values less than one use format 1:X and values greater than one use format X:1. Scale van be displayed by adding prefix 1: with the character s (e.g. 2000 -> 1:2000). Value can be multiplied by the power of ten with the character e. For example, e3 multiplies value by 1000 converting meters to millimeters.
Examples:
X%.3 123456.789 Writing with three decimals X%+.3 +123456.789 Sign also for positive values X%=.3 123456.789 Absolute value X%.2 123456.79 Normal rounding with two decimals X%.2< 123456.78 Rounding down with two decimals X%.-2 123500 Rounding with negative decimals $SCALE%. 123.456 Numeric attribute with default decimals $SCALE%s.0 1:123 Numeric attribute as scale $VALUE%.1"%" 0.2% Value as percentage $VALUE%p.1 23.4% Value multiplied to percentage $VALUE%o.1 234.5‰ Value multiplied to per mille $VALUE%e3.1 234.5 Value multiplied by thousand $SLOPE%q.1 1:23.4 Value as ratio $SLOPE%q.1 43.2:1 Value as ratio $MISSING%.0 0 Missing numeric value as zero $MISSING%_.0 Missing numeric value as empty $CRD_B@14%+.2 +123.45 Calculation result attribute formatted
Degree, minute and second formatting is defined by lowercase letters d, m and s with some possible separator characters between them. Definition can contain different combinations of these, but the order must always be degrees, minutes and seconds. It is legal to omit some units, but not possible to jump over minutes (combination degree,second is not allowed). Even if the written value is negative, minutes and seconds are still written without leading sign. The width of each unit part is defined with amount of characters: d, dd, ddd, m, mm, s or ss. Shorter values are filled with zeroes from left. The separator between unit parts can be almost any single character. If separator character has some special meaning in format definition (quotes, data item separators), it must be preceded by caret (^). Space separator can be given with underscore (_).
The value can be converted to radians with the letter r or to gons with the letter g. Radians can also be multiplied with the power of ten by adding exponent after the letter r (e.g. r4 multiplies by 10000). With the letters - and ¤ the value can be forced between -PI - PI or 0 - 2xPI.
Examples:
X%r.5 1.23456 Value in radians with decimals X%r5.0 123456 Value in radians multiplied with 100000.0 X%g.4 1.2345 Value in gons with decimals X%-g.4 -1.2345 Value in gons between -PI - PI X%¤g.4 1.2345 Value in gons between 0 - 2xPI X%d.3 1.234 Just decimal degrees, same as %.3 X%d.0< 1 Just degree part X%dd.0< 01 Degree part as two characters X%ddd.0< 001 Degree part as three characters X%m.0< 3 Just minute part X%ss.0< 05 Second part as two characters X%ddmm.3 0103.456 Degree part and minutes with decimals (NMEA) X%ddmmss.3 010305.678 Degree part, minute part and seconds X%d_m_s.3 1 3 5.678 Space separator X%d°m^'s^".3 1°3'5.678" Separators °, ' and " X%dd°mm^'ss^".3 01°03'05.678" Separators °, ' and " with zero filling
Constant text can be given after definition in double or single quotes. Constant text in double quotes can contain single quotes and vice versa. By default this constant text is written after the value. Alternatively character & can be used as a position marker for value inside constant text. For example, constant text "dx=&" writes text before value and constant text "(&)" writes text both sides of value. Constant text can also contain linefeeds marked with vertical bar.
Examples:
$VALUE%"%" 1.234% Unit after value $VALUE%.1"%" 1.2% Unit after value $VALUE%.1"m" 1.2m Unit after value $VALUE%.1" m" 1.2 m Unit after value $VALUE%.1"& m" 1.2 m Unit after value $VALUE%.1"value=&" value=1.2 Title before value $VALUE%.1"(&)" (1.2) Value in parenthesis $VALUE%.1"'&'" '1.2' Value is single quotes $VALUE%.1'"&"' "1.2" Value in double quotes $VALUE%.1"value|& m" value Multiline text 1.2 m