8

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....


6

If you want to retrieve the point layer ID, you can use these expressions as default values : For start point : array_first( aggregate( layer:='point', -- here put the name of the point layer aggregate:='array_agg', expression:="ID", -- here put the name of the point layer field you want to get filter:=...


5

One of the solutions in a long way may be the following. array_to_string( array_foreach( string_to_array(linecode, '_'), if( 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 ...


5

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 ...


5

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.


4

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 ...


3

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 ...


3

You can use Menu Processing / Toolbox / Geometry by expression to create the lines you want: if ( "Class" = 'building' , make_line ( $geometry, geometry ( get_feature ( 'points', 'Class', 'junction' ) ) ), NULL ) If you want to have ...


2

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.


2

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.


2

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 ( generate_series( 1, num_points( buffer($geometry,1000) ) ), to_string(x(point_n(buffer($geometry,1000), @...


2

Instead go to field calculator, click on Update existing field, and then select the column where you have to add the value and in below Expression box Add the value in single inverted comma Ex 'No'


1

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 file1='path/file1.xls' file2='path/file2.xls' df1 = pd.read_excel(file1, sheet_name='Sheet1') ...


Only top voted, non community-wiki answers of a minimum length are eligible