The geometry type does not need to be written in capital letters. But of course, the wkt string should have closing coordinates. Seems like a bug to me as on Windows 64bit version of 3.16.2 and 3.10.12 I get closing coordinates when using geom_to_wkt($geometry).
However, as stated by Kadir Şahbaz, QGIS should be able to work without. However, just to ...
WKT is case-insensitive for definition of geometry (Reference) and QGIS accepts the WKT string without the first and last point being the same.
geom_from_wkt( 'Polygon ((27 52, 31 37, 18 21))' )
geomWkt = QgsGeometry.fromWkt('Polygon ((27 52, 31 37, 18 21))')
Note that unlike some programs, QGIS will close the ...
The user Python functions are stored within the profile directory of your active profile. Under Mac it should be something like ~/Library/Application\Support/QGIS/QGIS3/profiles.
The easiest thing will be use Menu: Settings->User Profiles->Open Active Profile Folder. There you will find a folder /python/expressions where the Python functions are stored....
I keep a copy of QGIS 2.18 to solve problems just like yours. Use the tool Points to Paths (note the plural Paths), which, sadly, was never ported to 3.x. This tool creates an output line from each point pair, where the attributes from the beginning and ending point in each pair are transferred to their respective line in the output layer.
2.18 is easily ...
If you want to retrieve the point layer ID, you can use these expressions as default values :
For start point :
layer:='point', -- here put the name of the point layer
expression:="ID", -- here put the name of the point layer field you want to get
If you need the IDs of the intersecting points, see J. Monticolo's answer. If you need the lines ID, keep on reading:
Unfortunately, you can not use $id or @row_number directly. Not sure why, but I assume its because you can not determine the id of a not yet existing feature. You will also see this in preview, which returns a negative number, which is not ...
If you want to use regular expressions, you can do this with the following expression in the field calculator - see the PCRE Regex Cheatsheet (that's the regular expression engine QGIS uses) for functions and syntax.
This solution first converts your input to an array (each element delimited with _ is considered a separate value in the array), then with a ...
One of the solutions in a long way may be the following.
right(@element, 1) = 'F',
substr(@element, 0, strpos(@element, 'F') - 1),
'-' + substr(@element,0, strpos(@element, 'B') - 1)
How does it work:
split the value ...
You can use regexp_replace function in field calculator:
regexp_replace( "linecode", '^-(.*)$', '\\1B')
will replace '-' + 'any string' with 'any string' + 'B'. So it will change string '-0345' to '0345B'. \\1 refer to the expression part in brackets. You may give more specific regexp instead of '.*'.
The second expression will ...
What you can do is using an expression to get the names of your attributes. The core of this solution is that you can use the expression attributes() in combinaiton with map_akeys. When you have the name of the field, you can get it's value for each feature with attribute(attribute_name). Thus you can use this to multiply it, let's say by 4, like this: ...