On QGIS 3.10.3 or above
You can do that in this way:
# Prepare options for layer1
options = QgsVectorFileWriter.SaveVectorOptions()
options.driverName = "XLSX"
options.fileEncoding = "utf-8"
options.layerOptions = ["GEOMETRY=AS_XYZ"]
options.layerName = 'layer1'
# Export layer1
result, error_str = QgsVectorFileWriter....
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
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 ...
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 ...
You probably use shapefile format. Otherwise it should have worked.
According to the documentation shapefile format doesn't store date and time in the same field. You need to add date and time to seperate columns or use other format like GeoPackage.
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 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 ...
You can use Menu Processing / Toolbox / Geometry by expression to create the lines you want:
"Class" = 'building' ,
If you want to have ...
You are using a search cursor to READ your dataset and applying a sort whilst reading it, you are not editing it!
If you want to permanently sort rows in a table you need to use the SORT tool, this will create a new dataset sorted.
The issue could be with a field names disc.m
The best way is to export the data to a feature class in a file geodatabase.
Observe that the field name is converted to disc_m which is acceptable and the table opens without any issue.
You could if you use the same expression, but not directly take the expression from the geometry generator.
with your example using a buffer over a point layer:
array_to_string( array_foreach (
Some advanced format creation options can usually be found in OGR format specification: https://gdal.org/drivers/vector/xlsx.html
There are no options suitable for your need but you can easily merge the files afterwards using pandas like this:
import pandas as pd
df1 = pd.read_excel(file1, sheet_name='Sheet1')