QGIS/resources/context_help/QgsFieldCalculator-en_US

56 lines
3.2 KiB
Plaintext
Raw Normal View History

<h3>Field Calculator</h3>
The field calculator allows you to update fields with expressions.
<h4>Supported Operations</h4>
<table border=1>
<tr>
<th>Operation</th>
<th>Description</th>
</tr>
<tr>
<td>
<tt>column_name</tt><br>
<tt>"column_name"</tt>
</td>
<td>value of field <tt>column_name</tt></td>
</tr>
<tr><td>'string'</td><td>literal string value</td></tr>
<tr><td><i>number</i></td><td>number</td></tr>
<tr><td>NULL</td><td>null value</td></tr>
<tr><td>sqrt(<tt>a</tt>)</td><td>square root</td></tr>
<tr><td>sin(<tt>a</tt>)</td><td>sinus of <tt>a</tt></td></tr>
<tr><td>cos(<tt>a</tt>)</td><td>cosinus of <tt>b</tt></td></tr>
<tr><td>tan(<tt>a</tt>)</td><td>tangens of <tt>a</tt></td></tr>
<tr><td>asin(<tt>a</tt>)</td><td>arcussinus of <tt>a</tt></td></tr>
<tr><td>acos(<tt>a</tt>)</td><td>arcuscosinus of <tt>a</tt></td></tr>
<tr><td>atan(<tt>a</tt>)</td><td>arcustangens of <tt>a</tt></td></tr>
<tr><td>to int(<tt>a</tt>)</td><td>convert string <tt>a</tt> to integer</td></tr>
<tr><td>to real(<tt>a</tt>)</td><td>convert string <tt>a</tt> to real</td></tr>
<tr><td>to string(<tt>a</tt>)</td><td>convert number <tt>a</tt> to string</td></tr>
<tr><td>lower(<tt>a</tt>)</td><td>convert string <tt>a</tt> to lower case</td></tr>
<tr><td>upper(<tt>a</tt>)</td><td>convert string <tt>a</tt> to upper case</td></tr>
<tr><td>length(<tt>a</tt>)</td><td>length of string <tt>a</tt></td></tr>
<tr><td>atan2(y,x)</td><td>arcustangens of y/x using the signs of the two arguments to determine the quadrant of the result.</td></tr>
<tr><td>replace(<tt>a</tt>,<i>replacethis</i>,<i>withthat</i>)</td><td>replace <i>replacethis</i> with <i>withthat</i> in string <tt>a</tt></td></td>
<tr><td>regexp_replace(<tt>a</tt>,<i>replacethis</i>,<i>withthat</i>)</td><td>replace the regular expression <i>replacethis</i> with <i>withthat</i> in string <tt>a</tt></td></td>
<tr><td>substr(<tt>a</tt>,from,len)</td><td>len characters of string <tt>a</tt> starting from from (first character index is 1)</td></td>
<tr><td><tt>a</tt> || <tt>b</tt></td><td>concatenate strings <tt>a</tt> and <tt>b</tt></td></tr>
<tr><td>$rownum</td><td>number current row</td></tr>
<tr><td>$area</td><td>area of polygon</td></tr>
<tr><td>$perimeter</td><td>perimeter of polygon</td></tr>
<tr><td>$length</td><td>area of line</td></tr>
<tr><td>$id</td><td>feature id</td></tr>
<tr><td>$x</td><td>x coordinate of point</td></tr>
<tr><td>$y</td><td>y coordinate of point</td></tr>
<tr><td>xat(n)</td><td>x coordinate of nth point of a line (indizes start at 0; negative values apply to the last index)</td></tr>
<tr><td>yat(n)</td><td>y coordinate of nth point of a line (indizes start at 0; negative values apply to the last index)</td></tr>
<tr><td><tt>a</tt> ^ <tt>b</tt></td><td><tt>a</tt> raised to the power of <tt>b</tt></td></tr>
<tr><td><tt>a</tt> * <tt>b</tt></td><td><tt>a</tt> multiplied by <tt>b</tt></td></tr>
<tr><td><tt>a</tt> / <tt>b</tt></td><td><tt>a</tt> divided by <tt>b</tt></td></tr>
<tr><td><tt>a</tt> + <tt>b</tt></td><td><tt>a</tt> plus <tt>b</tt></td></tr>
<tr><td><tt>a</tt> - <tt>b</tt></td><td><tt>a</tt> minus <tt>b</tt></td></tr>
<tr><td>+<tt>a</tt></td><td>positive sign</td></tr>
<tr><td>-<tt>a</tt></td><td>negative value of <tt>a</tt></td></tr>
</table>