Questions tagged [expression]

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

46 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
37 views

Displaying images as part of multiattribute labels using QGIS

I would like to display images referenced in an attribute column as part of a multiattribute label, so that I can eventually print them with the map. I do not want to display geotagged images, since ...
4
votes
0answers
80 views

Set background or text color depending on expression in an attribute table in QGIS composer

I am using QGIS 3.0.2. I am working on a print composer including an attribute table. I would like to set different colors to each rows, depending on an expression, refering to an attribute. I didn't ...
4
votes
0answers
208 views

Using transform function in QGIS layer geometry generator?

I'm trying to use the following expression in the geometry generator in a QGIS layer to show a 1-mi boundary around points: buffer(transform($geometry, 'EPSG:4326', 'EPSG:2877'), 5280) However, the ...
3
votes
0answers
79 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
103 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
0answers
142 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 * @...
2
votes
0answers
53 views

Converting lat/long to EPSG:27700 in geometry generator expression

I have incorporated a geometry generator into a style in QGIS 3.4 which creates a callout line from a feature to its relevant spatial position. For reasons out of my control our projects use CRS: ...
2
votes
0answers
35 views

Can I symbolize based on the syntax in a description attribute colum?

I got a kmz-file from an organization and the attribute table has a colum 'description' with a synthax that holds import information (such as date built, water source, village etc.) instead of a ...
2
votes
0answers
93 views

Calculate length of selected features in PyQGIS

I create a selection with getFeatures(QgsFeatureRequest()) and I want to calculate the length of the result which is a QgsFeatureIterator : select = QgsExpression(" myexpression ") selectedfeats = ...
2
votes
0answers
92 views

How to add Projection name, Ellipsoid, and Datum in QGIS 3 layouts

I am trying to add the map CRS information to text boxes in a layout in QGIS 3 automatically so if the project crs changes the text in the map will also change. I can add the EPSG code to a text ...
2
votes
0answers
71 views

How to set diagram color based on conditional expression?

I'm trying to create a map with pizza diagram, and I'm using the following expression: CASE WHEN pH >= 6 AND pH <= 9 THEN Color_rgb (0,166,226) WHEN pH <= 6 AND pH >=9 THEN ...
2
votes
0answers
281 views

Label only one polygon in canvas/map view per category/value in attribute table

Question: In QGIS (2.18), how do you show only one label per field of view in the map canvas for each visible category (that is displayed in the map view/canvas at any given scale/focus) of a multi-...
2
votes
0answers
170 views

How to get the name of the layer on a map composer with a single layer?

I tried layer_property( 'layer', 'title') I would like to return the current layer from the map instead of 'layer'. (or list of the layers on the map?) Doesn't seems to works with layer_id or ...
2
votes
0answers
83 views

CalcInterior expression help in QGIS

In QGIS on a new layer I'm trying to calculate the area of certain landtypes individually from a Grounds Maintenance layer. Previously I have used the following expression in Cadcorp SIS: ...
2
votes
0answers
262 views

QGIS 2.8.2 - Using spatial expressions in labelling

I'm creating some hard copy map output from QGIS. I want to use an expression to suppress labels for some features on a layer when another feature from another layer intersects with those features. ...
1
vote
0answers
40 views

Define color for label-buffer with data-defined override/expression

In QGIS 3.8 (Win 10) I have a Point-Layer with labels in a certain distance and leader lines, created with geometry-generator. The leader lines in some cases cross below the label and are masked by a ...
1
vote
0answers
25 views

ArcGIS Pro calculate field using arcade not working?

Im trying to calculate a field called "bark t/ha" using the following expression: if ($feature.Barkfuelhaz =="Low"){ return"0"} else if($feature.Barkfuelhaz =="Moderate"){ return"1"} else if($...
1
vote
0answers
48 views

Layer Styling by Geometry Generator in QGIS 3.6

I am trying to create custom styling by using Geometry Generator in QGIS 3.6 but I got an error expression. segments_to_lines ( $geometry) ramp_color('Viridis', scale_linear( length( ...
1
vote
1answer
82 views

Use expression to only keep 1 layer in the legend

When I print my project, that includes different layers, I always end up with all the layers in the legend. What I want when printing is to only show 1 layer, that always has the same name "Werken". ...
1
vote
0answers
78 views

QGIS Duplicate Labels still appearing despite suggested changes. Do i need to do an expression?

I have one field called Streets. In Streets there are road beds with suffix as Pkwy, Street, Avenue, Expressway and so on. I also want to label some of these road beds. In Layer styling under ...
1
vote
1answer
70 views

Using Click locations to determine azimuth in QGIS 3

I am using QGIS 3 64bit. While adding points to a shapefile (layer), what expression captures the insertion point coordinates of a point feature to use as a start point for an azimuth determination ...
1
vote
1answer
56 views

Search plot by total area of two adjacent plots

I've got some QGIS data where each plot is described with some attributes e.g. Shape_Area which is the field describing the area of plot in m2. Normally I search for plot using the expression e.g. ...
1
vote
1answer
323 views

Labeling expressions on AGOL with Arcade for certain features

I am working on a web map in AGOL for the indoor office map. I have some issues writing custom expressions with Arcade in order to label the types of rooms (office rooms) based on another attribute ...
1
vote
0answers
37 views

Create label from different fields in ArcGIS Desktop?

I want to create label like this one in ArcGIS Desktop 10.3.1. Is there anyway to create label like this? Each data come from different field. I can create a label with box or a number with degree....
1
vote
0answers
39 views

Using formatting option 'aligned' in 'to_dms' function in QGIS 3.4.2

Using formatting option 'aligned' in the expression: to_dms(x(transform($geometry,'EPSG:32632','EPSG:4230')), 'x', 2, 'aligned') not only is the alignment of degrees, minutes, seconds as expected, ...
1
vote
0answers
29 views

setFilterExpression not giving results because of space?

I am trying to select data based on QgsVectorLayer() getting it's features from layer.getFeatures().next() method. When I pass expression in that using QgsFeatureRequest().setFilterExpression(...
1
vote
0answers
82 views

Creating in-line variable is possible in field calculator of QGIS 2?

I create new field based on other fields. For example; if "Field_A" is smaller than "Field_B", value of new field is 'A', otherwise it is 'B'. So I want to create new variable for this case within ...
1
vote
0answers
48 views

Features duplicated in multiple, different fields - label expression to avoid duplicate labels

Using ArcMap 10.4.1. I am trying to label a feature class of roads, there are 5 types: U.S. Highways, State Highways, County, Municipal, and Off Highway. Sometimes a road feature belongs to two ...
1
vote
0answers
92 views

Force expression-based map item position onto second page in Atlas setup?

I created an atlas with two pages for each atlas feature, the first being for a map and the second page being for a table. I need to separate pages as the map is using all the paper space and the ...
1
vote
0answers
62 views

Calculated sum of visible areas in print composer

I want to view the sum of area of each habitat displayed in the layout. Only the displayed habitats in the viewport. Which expression do I have to use in the textbox? Now I have calculated them manual....
1
vote
0answers
159 views

creating new fields and populating with sequential numbers based on grouping other columns

(Relatively new Qqis user) I have a vector layer (lines) for a road network - which has a field for each road name and a field for road segments - but I need to add fields for numeric IDs rather ...
1
vote
0answers
120 views

QGIS Expression Calculator Field Shows Null

When I go into the expression builder under the "Field and Values" drop down on the left side, instead of a list of field for the layer all it says is NULL. Is there something that would cause this ...
1
vote
0answers
113 views

Scale color ramp filtered on common layer columns, in QGIS

I'm creating an atlas in QGIS showing bus lines, tax fare zones, and travel flow lines. I have a layer with bus lines - one feature per bus line. Moreover, I have a layer with travel flow lines - ...
1
vote
0answers
257 views

QGIS use relations in expressions (for symbol and print composer)

I have a shapefile layer a relation linking data from a csv file. This is a one to many relationship where a parcel could have multiple entries from the csv. How do I reference that data in ...
1
vote
0answers
41 views

Add field in table with layername as value

I need to merge multiple tables (I'm planning to use "merge" for this). I also need a new column in the original tables that show the name of the source table. Is there a way I can add a field that ...
1
vote
0answers
114 views

Warning/Error message “The ) is expected” - Functional Attribute - GeoMedia Desktop

So the problem, is when I write my Expression on the Functional Attribute window in GeoMedia Pro, it gives me a warning message indicates that the ")" is expected; The expression is : ROUND(AREA(...
1
vote
0answers
61 views

MapServer - How to display only X characters of annotation LABEL (text\string) based on [field]

In MapServer how\where do you use an expression to force a label to 5 characters to appear as annotation\labels
1
vote
0answers
105 views

Data dependent override on colour and linewidth of line pattern fill not working after upgrade to QGIS 2.12

I have recently upgraded to QGIS 2.12 which has resulted in a problem with one of my projects, whereby the data dependent override of the line width and colour of a line pattern fill and SVG marker ...
1
vote
0answers
46 views

How would I build the syntax inside a request in the case I wanted to multiply 2 variables?

I would like add something to my previous question (here: How to build QgsExpressions in python?) How would I build the syntax inside this request in the case I wanted field_name to be also a ...
1
vote
0answers
70 views

Text box with automated coordinate reference system in use on Qgis

Using an expression, is it possible to automatically fill a text box placed on the map (in the composer) showing the reference coordinate system of the project? If possible, how would that expression ...
1
vote
0answers
420 views

How to define a custom function that returns value of a field in an unsaved form

Filter expression builder in QGIS 2.8 allows us to define custom functions using python. I'm intrested would it be possible to define a function which returns a value of a field in an unsaved form ...
1
vote
0answers
157 views

Masking Labeles in the Compositor in QGIS 2.8.1

I am looking for a way to remove/mask out Labels that are under a composer Element (Overview Map), which I moved in front of my main map. Is there no way to do this? Maybe using the ItemID? I tried ...
0
votes
0answers
61 views

QGIS Value Relation filter

Let's say I have 3 layers: point layer (columns: id, group), table layer named materials (columns: point_id, mat_id), table layer named mat_list (columns group, mat_id). There is relation between ...
0
votes
1answer
129 views

Setting new value into field created by PyQGIS?

I'd like to create a new field named "vctcn93", loop the features of active layer, if string "metro" in feature name, I'd like to add a value string "get" into the field "vctcn93". But when I check ...
0
votes
0answers
70 views

Clustered labeling in Mapinfo

I need to create a query where if a property with the same lotplan has the same address it is only displayed once. In case 1 we have the same lotplan and I want it to just show 32 once. In case 2 - ...
-1
votes
1answer
120 views

Where Clause looking at two Columns and a RANGE Expression

Using ArcPy I'm Trying to Set up a Where Clause with a RANGE in my "FeatureClassToFeatureClass_conversion" This {Where Clause} needs to Query Two Columns in the data: FEATURE = 'ENVIRONMENT' and ...