Questions tagged [expression]

Expressions are SQL-like statements that are used to evaluate dynamic properties.

Filter by
Sorted by
Tagged with
3
votes
0answers
102 views

Updating shared custom functions / expression code in QGIS

All the QGIS documentation I've seen on custom functions (used in expressions) says that the code is saved in the user's local expressions directory, e.g. ~/.local/share/QGIS/QGIS3/profiles/default/...
3
votes
0answers
117 views

Create multipoint layer from array by expression

I have two layers. One shapefile point layer, called "point1" and one csv no geometry layer, called "Meta". "point1" looks like: id bd 1 a 2 b 3 c 4 d 5 e 6 f and so on... "...
3
votes
2answers
233 views

Rotating features generated by the geometry builder

In QGIS I have a point feature with "Rotation" field. Using the geometry builder I am trying to build square geometries based on the XY as centre and rotated based on the "Rotation" field using the ...
3
votes
0answers
143 views

Custom QGIS expression to filter atlas pages

I want to filter my atlas pages based on a list returned by a custom function but it won't work. This is my function: from qgis.core import * from qgis.gui import * from qgis.utils import * @...
3
votes
0answers
540 views

Select by expression doesn't work - QGIS [closed]

I want to make a "selection by expression", as shown on the screenshot. I choose the FIELD and the VALUE from the side panel, but it's selecting 0 rows (there are actually more than 100...). I just ...
2
votes
4answers
412 views

Count touching and near points for every polygon (QGIS)

I have a polygon and a point layer. The polygons contains buildings, the points should be the edges of the buildings. A building is "good" as much as points are touching or in the near (buffer 0.2 ...
2
votes
2answers
3k views

Creating a label from two Attribute table column titles with a space between them

would anyone happen to know the expression I need to type so that i'd have a space between two attribute columns titles in QGIS' Label expression dialogue?
2
votes
3answers
183 views

QGIS Select by expression - buffer selection

I want to select points 2 and 3 with a 'selection with expression' in QGIS 3.4. I want to do this by using the buffer function in the expression builder. I already managed to create a separate ...
2
votes
2answers
2k views

Displaying unit as 'text' within label in QGIS?

When labelling areas in QGIS I can't figure out how to display the unit after the number value from a field. For example the area of my polygon might be 1.23 hectares, which has been calculated ...
2
votes
2answers
3k views

How can I get features that satisfy a QgsExpression using PyQGIS?

I have two fields say "State" and "name" which would be get from the two comboboxes. After which, based on the current text in the combo box, I want to make QgsExpression and feature that satisfies ...
2
votes
1answer
578 views

How to remove first two and last two characters from each label in ArcMap [closed]

My too long labels take up too much space in regard to the small counties polygons. I want to remove first two and the last two characters from each single label. Currently the labels on the map look ...
2
votes
2answers
1k views

Search for string and only display characters before it in Mapinfo label expressions

So I have a property table that has addresses like below. 12 Andrews CL, Pxxx 1/12 Andrews CL, Pxxx 2/31 Macrossan ST, Pxxx 2/7-11 Barrier ST, Pxxx I need to only show 12 1/12 2/31 2/7-11 Can ...
2
votes
1answer
98 views

Colour coding vector layers?

Based on a previous post, I tried to implement this in the expressions tab: CASE WHEN "dBM" <= 0 THEN '255,0,0' WHEN "dBM" > 0 AND "dBM" <= 20 THEN '255,255,0' ELSE '0,255,0' However, ...
2
votes
2answers
326 views

How to scale features declining using map units in QGIS

I have layer in QGIS that I want to style using SVG symbols. I want the SVGs to increase in size when zooming in the map. I can solve this by using map units instead of millimeters. Though, I don't ...
2
votes
1answer
2k views

Adding text to end of existing value in QGIS

I have a column in a large attribute table. The values in this column are numeric value. Example entries in this case would be: 1, 2.0512, 8.5744, 8.944 How can I add the word 'm' to the end of ...
2
votes
1answer
2k views

Adding units to numeric labels in ArcMap?

How do I add the distance units to labels in ArcMap? I have the area calculated and would like the label to be displayed as (XXX sq ft). I was able to write a VBScript of "(" & [AREA] &" ...
2
votes
2answers
84 views

QGIS expression using Aggregate and start_point to select a vector within a buffer

I am trying to put a default value of a field so that the value always updates once any change is make item. Either the expression builder or function editor are fine. I'm more familiar with the ...
2
votes
2answers
82 views

How to get directory from filepath in QGIS action

I have in QGIS layer that contains filepath (e.g. D:/file/28238/pic/D4D3-06_1.png) and I would like to get directory path only like D:/file/new/28238/pic. Is it possible to do by expression in field ...
2
votes
1answer
84 views

Filling a field with automatic numbering specific by unique value of another field with QGIS expression

I have a table with 2 fields: NUMBER (integer) and TOWN (text). I would like to find an expression that fills the NUMBER field with an automatic number specific for each value of TOWN. Example: NUMBER ...
2
votes
1answer
1k views

Setting all values in column to be same using QGIS?

Using QGIS, I want to fill a whole column with the same "word". Is there a faster way or an expression I can use in the field calculator instead of copy/paste? In some layers I have more than a ...
2
votes
1answer
441 views

Calling QGIS functions via Function Editor?

I am trying to write function in QGIS via function editor and the problem is to call QGIS built-in functions e.g. azimuth, centroid... etc. When I run my script, I get 'global name 'azimuth' is not ...
2
votes
2answers
277 views

QGIS Select double feature by attributes

There is this point shapefile in QGIS (2.12). There is one column with the street name and one with the housenumber. Is it possible to select all features that have the same street name and ...
2
votes
2answers
53 views

Colouring three individual attributes in point layer using QGIS?

I am new to QGIS and am learning the expressions function. I would like to know how to independently colour three separate attributes on a point layer as below:
2
votes
1answer
34 views

Categorizing data by partial attribute

In QGIS 3.4 I'm trying to categorize a column in my attribute table which contains a code, of which I only need the (highest) number (which implies a gradation). This probably means I need an ...
2
votes
1answer
45 views

Replace Part of String with a different String in QGIS using Python [closed]

I am trying to fix a field that has Street Names. Some of the features' Street Names have abbreviation rather than the full name of the type of street like for example 'PRESTON LAKE DR' when it should ...
2
votes
1answer
124 views

Layout expression for getting all features of layer within the current map view in QGIS 3?

In a map layout template, I want to insert an expression which gets all feature's names of a certain layer, which are contained in the current layout's view/extent. Is there a way to get an aggregate ...
2
votes
1answer
407 views

Using QGIS Expression String Builder to display selected multiple layers in a map in print composer

In QGIS, in a Map's item properties, inside print composer, there is an option to "lock layers" (display layers) based on an expression, by using QGIS "expression string builder". I can use as ...
2
votes
1answer
116 views

Simultaneously exporting from multiple shapes by expression in QGIS?

I am working with OSM road shapes, there are 64 shapes for the whole American continent. I use "Select Features using an expression" tool to export selected classes from the "highway" field. (...
2
votes
2answers
2k views

Adding text to label expression in QGIS?

Using QGIS 2.18 I have line feature and want to add a foot tick mark and a deg symbol to label the label as of now shows "dis" || "Azimuth" 339045 I would like it to show 3391' 45 deg The ...
2
votes
1answer
187 views

How to clean data in attribute table in QGIS 2.18.14?

I have a 'name' field with composite name; numbers and words e.g. "1237, Café" I managed extract the part number with Field Calculator and make a new field (see 1) with this expression left( "...
2
votes
2answers
272 views

How do I filter large set of points (481,308) in QGIS attribute table by fixing the extents(Lat Long values)

I have a large set of points (481,308) in single QGIS layer with the attribute table(ID, LAT, LONG,..ETC). But I only need points which fall inside particular area or polygon, I have fixed the extents ...
2
votes
1answer
119 views

Expression Builder in QGIS in editing Attribute Table

I am working with a simple attribute table that has 4 columns; 'Xcoord' 'Ycoord' 'id' 'id2' 'id2' is a new field that i added to the attribute table. 'id' is a field showing land use classes with ...
2
votes
2answers
888 views

How to concatenate strings separated by dot in PyQGIS?

I would like to concatenate the string of field1 with field2 separated by dot and so on. However, when I put the "." the attribute values remain null. How to separate string by dot? e = QgsExpression(...
2
votes
1answer
784 views

Get value of Variable in custom python expression function

I am writing a custom python expression function to return the value of a variable. By variable, I mean the layer, project, or global variables. I looked at this answer https://gis.stackexchange.com/a/...
2
votes
2answers
496 views

Writing QGIS field calculator expression? [duplicate]

I have an attribute table with a real data type column named "Volume". Some of these cells have no value, and I want to replace the NULL with a dummy value like -999. In the Field Calculaor I select "...
2
votes
1answer
152 views

How to search for a text from column1 in column2 in QGIS?

I have street names in a column (column1) as well as in another one (column2). I would like to write a selection expression to find out if there are similar street names (or parts of the names) ...
2
votes
2answers
643 views

Convert Date Field to String Field Arcpy

I have a Date field in an ArcGIS file geodatabase feature class called "DateTemp1." I created a new text field called "DateTemp2" and want to calculate that based on the DateTemp1 field, but I am ...
2
votes
1answer
1k views

Filter spatialite layer with 'not equal' in QGIS

I tried to filter my spatialite layer with the "SPECIES" IS NOT NULL OR "SPECIES" != 'Corvus corax' expression, but the result contains the lines where "FAJ" field is 'Corvus corax' (the NULL value ...
2
votes
1answer
2k views

If-then expression in Mapinfo label expressions

Firstly this is similar to If-Then Label Expression BUT I need this for Mapinfo. So I want to do the following in Mapinfo in the label expression box in ver 12. if RuralAdd='R': address=St_No + " ; ...
2
votes
2answers
3k views

How to convert decimal point to comma in QGIS?

I am working with data in Colombia where decimal points are written as commas. I would love to create a new column in QGIS that would convert all decimal points (periods) to commas for the purpose of ...
2
votes
1answer
37 views

Nesting filename in composer without file extension

I just want to supress the file extension (.qgs) on my file name: srv1245_d005.qgs. [% substr(@project_filename ,1,12)%] works although sometimes our filename will be 13 characters long or more so ...
2
votes
2answers
96 views

Selecting latest date by expression

I am trying to select the latest date by expression in QGIS. I tried to use this code "Date"= maximum("Date"). But nothing was selected. I wonder what is the right expression code to select the ...
2
votes
1answer
31 views

Expression that selects all objects that share the same value in field 1, among them selects the object with the highest value in field 2

I have a table with thousands of objects but created an example Image for this question. I need an expression that does the following. Select all objects that share the same values in field 1. ...
2
votes
1answer
28 views

Expression that selects all objects with same value in field one and among the choosen ones figures out the highes value in field two

I have an Attribute table similar to the one in my example Picture, just with thousdands of objects. Some of the objects have the same value in "field 1" but different values in field 2. I want to ...
2
votes
1answer
137 views

In QGIS for Type Case in Labels, Rule Based Rule, the Capitalize first letter option does not work

Here are my labels untouched Now when i change to all lowercase You see that it changes However for type case i want to capitalize first letter It shows that it made it everything capitalized ...
2
votes
1answer
43 views

Problems filtering using multiple parenthetical expressions in QGIS 2.18 OSX Yosemite

I'm not a QGIS power user but I've been using it for simple things for quite a while. I just updated from QGIS 2.14 to 2.18 yesterday in order to be able to edit field names. I'm now having some ...
2
votes
1answer
196 views

Creating an aggregate function filtered by entry value

Can anyone help me parse an aggregate function for Qgis 2.18 which sums the values of one field, for all entries which match a value of the entry in question. So, for example if I have a simple ...
2
votes
2answers
279 views

Shows previous Atlas features grayed out

I try to make a set of maps using QGIS Atlas. My maps will consist of selected feature with it's attributes (using $id = @atlas_featureid, and that's working). Basically - districts in particular city ...
2
votes
1answer
173 views

Expression to run two geometry functions in expression builder

I have feature polygons that sit within and across larger tenancy polygons, I need to transfer the tenancy reference from the tenancy polygons to the feature polygons. To do this I am using AutoFields ...
2
votes
1answer
209 views

Multiple rule based expressions with 2 layer styles in Atlas

I have 18 transects over a geographical extent and I am applying atlas to display a map for each transect. All is going well and I'm venturing into expressions and rule based rendering $ID = @...