New answers tagged

5 votes
Accepted

Converting number with leading zeros in integer in QGIS

Try this expression with the to_int() function: to_int("baumnummer") -- to_int('000001') -> 1 If you wish to maintain the string field type, you could expand the expression above with ...
user avatar
  • 23k
4 votes
Accepted

Converting text field with special characters to field with floats in QGIS

regexp_substr( "stringfield", '(-?\\d+\\.?\\d*)') https://www.tutorialspoint.com/How-to-extract-numbers-from-a-string-in-Python
user avatar
  • 51.3k
5 votes
Accepted

Displaying milliseconds in Attribute Table using PyQGIS

The comment by @Matt was already pointing in a correct direction. QgsDateTimeFieldFormatter is indeed needed to modify the display of DateTime values. The following code example replaces the default ...
user avatar
  • 1,454
4 votes
Accepted

Renaming categorical attribute values in QGIS attribute table: merge two different strings to the same name

Just run Field calculator, update the field by typing this expression: if ( "Species" in ('DD', 'Delphinus Delphinus'), 'Delphinus Delphinus', "Species" ) Here I ...
user avatar
  • 40.1k
6 votes
Accepted

Using QGIS field calculator to create an 'fid' column according to a value from another column

Hacky solution using the field calculator: array_find( array_agg( expression := to_int(substr("Row name", 5))*10*maximum("Col")+"Col", order_by := to_int(...
user avatar
  • 23.3k
7 votes

Calculating two columns at once in QGIS

QGIS has an algorithm for that : Statistics by categories (official documentation) You have to select your layer, your category field (here "Cover") and the field to calculate statistics (...
user avatar
  • 11.8k
1 vote

Categorizing field and summing attributes for label in QGIS

Use QGIS expressions with the aggregate function sum(), grouping it by the common part of the "CFSAUID" attribute. For this, define an expression that returns this common part, here ...
user avatar
  • 40.1k
4 votes
Accepted

Is there non spatial Virtual Layer in QGIS?

As was mentioned by @J.Monticolo in his comment it is possible to exclude the geometry simply by choosing 'No geometry' in the 'Geometry' tab Also as was mentioned by @MrXsquared in his/her comment: ...
user avatar
  • 23k
1 vote

Counting number of selected features in QGIS

There are several methods that I may refer you to: 1. Press Shift + F6 to open attribute table with selected features only. There will be two values that represent the number of selected features: '...
user avatar
  • 23k
0 votes

Can't save changes to attribute table in ArcGIS Pro

I found a workaround If you keep the editing fields table open and then in the table on the top ribbon click add a new field. A message will pop up asking if you want to save or delete edits. There ...
user avatar
2 votes

Counting number of selected features in QGIS

This works fine for me: from qgis.core import * import qgis.utils layer = iface.activeLayer() features = layer.selectedFeatures() print ("Total count", layer.featureCount()) print (...
user avatar
0 votes

QGIS defining beginning and the end of the linear element based on point location from the different layer

This can be done in 3 steps: Create a new WKT field in the Points layer geom_to_wkt( $geometry) Update the from field in the line layer with the following formula (assuming your points layer is ...
user avatar
  • 1,603
2 votes
Accepted

QgsAttributeTableView shows nothing in my QGIS plugin

Your class lacks of self, so, at the end of the instantiation (= end of the __init__), the references of the objects without self not binded in other objects of the class are destroyed, so not ...
user avatar
  • 11.8k
1 vote

Adding field to attribute table distorts existing columns using ArcMap

I was able to find a workaround. I exported the shapefile into a geodatabase. After loading the resulting feature-class to my map I was able to add fields to the attribut table without affecting the ...
user avatar
0 votes
Accepted

Trying to update attributefields from shapefile with field values from intersecting shapefile features

You can do it like this by using a spatial index for a greater performance. Check the code comments for explanations. As mentioned in the last comment, you did not mention what should happen if there ...
user avatar
  • 24.9k
1 vote

Hiding multiple horizontal rows in the attribute table in QGIS

To hide horizontal lines (rows) follow these steps: Left click on the layer in the table of content and open attribute table with F6. Select rows you would like to show. Left click on the layer in ...
user avatar
  • 5,632
0 votes

Hiding multiple horizontal rows in the attribute table in QGIS

One way to do this, would be to create a new attribute field, in which you could label values for only the 10 objects you wish to view as the same value. Then you can sort the rows by that value by ...
user avatar
  • 140
2 votes

Hiding multiple horizontal rows in the attribute table in QGIS

Right Click in the attribute table and select organzie columns Then uncheck all the columns you do not want to see.
user avatar
  • 688

Top 50 recent answers are included