Questions tagged [rule-based]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
15
votes
3answers
1k views

Controlling rule-based labelling using PyQGIS?

Following on from this question: How to turn on/off all labels of all layers in QGIS, OP mentioned in his comment that he uses rule-based labels. I tried searching online as to how these types of ...
9
votes
1answer
869 views

Visualizing layer using categorized AND graduated styles in QGIS?

I have a layer with road segments that come in five different classes and each have a value. I am trying to get a graduated color for the values (say, light blue for low and dark blue for high values) ...
8
votes
1answer
126 views

QGIS can't detect negative values?

I'm working with the last version of QGIS (3.8.3-Zanzibar), and I'm trying to represent a Rule-Based Symbology from a CSV file with the following rules: And the data from the prcptot column is this: ...
8
votes
1answer
224 views

cumulative atlas in QGIS 2.14 and above?

I have a question about something which I think is possible but just can't get my head round it, and haven't found any answers online. I'm using $id= @atlas_featureid in QGIS 2.14 to create an set of ...
5
votes
2answers
4k views

Rule-based labeling in QGIS

I'm trying to label visited countries in a world map shapefile, what is wrong with my rule : if( "Visited" = 'yes', "NAME", NULL)
5
votes
2answers
493 views

How can I apply a style rule to multiple categories? (2.14 and above)

I think this used to be more straightforward in earlier QGIS versions, but with more powerful rule-based styling (great development) I am now a little confused as to how to apply a rule to multiple ...
5
votes
1answer
85 views

Rule-based labeling with optional second field

I need to label some polygons with 2 fields using only one label: The first being a field in the attribute table named "Bio-Code" the second one being optional if a cell in the field "BBT-Code" is ...
5
votes
2answers
84 views

QGIS styling a legend

I am a newbie working on QGIS 3.6 / Windows 10 I need to style a legend for map with headings and sub headings The main divisions of the legend item need to be subdivided into sub-classes i.e. The ...
4
votes
3answers
3k views

Using 'max()' in expression with QGIS?

I want to make a rule-based style on the maximum value from a field. I set my expression like: max("fieldname") It returns every value instead of only the maximum one. Can anyone tell me the right ...
4
votes
1answer
86 views

QGIS Draw by rule

I have a point layer with several colored dots. Each dot represent a find of a bumblebee species. E.g. red is B.terrestris yellow is B.hypnorum. In my attribute table I have a column named "nest" (...
4
votes
1answer
2k views

Changing symbol size using the “Size assistant” in QGIS?

I need to change symbol size of a categorised shapefile. For this I tried using the Size Assistant (in the style menu: right click > change size > Data defined override > Size assistant) However my ...
4
votes
1answer
196 views

How to return array from label offset expression? [duplicate]

I am trying to set the x,y offset of layer labels based on a data defined override. What I'm trying is the following: CASE WHEN name is 'Brooklyn Bridge' [3.5, 0] ELSE [-3.5, 0] END However this ...
4
votes
1answer
176 views

manage qgis rule based styling duplicates

I am new to qgis. When I am using rule based styling, duplicates for some reason show all the matching symbols and not only the first match rule's symbol. How do I make show only one symbol even if it ...
4
votes
0answers
83 views

QGIS rule based symbology for rasters in Atlas?

I'm making species distribution maps and have got the Atlas working perfectly using a polygon layer to show the quarter degree grid cells for species observation records. I have ~ 250 species. Problem ...
3
votes
2answers
362 views

Label OSM polygons above a certain size?

I'm wanting to label polygons on a map that are above a certain area. These polygons are dervied from open streetmap and consist of either ways or multipart polygons ie If polygon is more than 160 sq ...
3
votes
3answers
2k views

Categorization with multiple values- QGIS 2.18

I'm trying to represent 2 columns in polygon layer. I've tried to do it with the rule-based style but didn't understand how to do it. This is the attribute table of the polygon: I've tried to use ...
3
votes
2answers
265 views

QGIS style polylines with alternate colours

I have a bunch of shapefiles with multiple polylines. Each consistst of 5 up to 30 polylines. I would like to define a style which colours them alternating two colours. When I use the Categorized ...
3
votes
3answers
336 views

Show all points (airports) in featured country only

I need to generate maps showing all airports located in a featured country. My airport shapefile has over 8000 points, so I need to remove those that are irrelevant. Example: When Sweden is featured, ...
3
votes
1answer
242 views

How to automatically assign specific ColorBrewer ramp to polygons so that no touching polygons share the same color in QGIS 2.16

I'm creating a series of reference maps that need to differentiate between administrative regions within a country. I created a new color ramp using ColorBrewer Dark2 with 8 categories. My ...
3
votes
1answer
116 views

Can qgis2web display rule-based layer style?

I’ve just made a map that has two layers: one that contains the polygons and other that contains points. For the last one, I used rule-based symbology where I define the size and colour of the points ...
3
votes
2answers
512 views

Displaying map labels over coordinate grid in QGIS?

My grid overlaps labels placed on a map. Is there a way of forcing the labels to be displayed in front/on top and the grid placed behind the text? Despite looking I cannot find a solution. Using ...
3
votes
1answer
67 views

Using the field calculator in rule based symbology

I am trying to categorise my site points by species group with rule based symbology; e.g. bat uses the formula "Group"='Bat' But I would also like to have a different symbol for where there are ...
3
votes
1answer
154 views

dynamic legendlabel for a rule-based style

I have a rule-based style that is linked to a print-composer. In that composer I activated the atlas-function with a filter. Because of that filter the outcome of the rulebased style varies. Is ...
3
votes
0answers
32 views

Label only the maximum value when I zoomed out or print in smaller scale using QGIS

I would like to prioritise the maximum values to be shown on the map. In other words, when the label collides it should drop out the minimum values. In the shown examples, I would like to have ...
3
votes
1answer
81 views

Nested rules in QGIS 2.18

I work with QGIS 2.18. I have a polygon shapefile with two atrributes: id (unique for each polygon) and type. I visualize the shapefile using the "type" attribute, but I would like to add a nested ...
3
votes
0answers
69 views

SOL help in QGIS: rule based styling to show timestamp increase via gradient

I have some polygon data from a tractor that shows it's route among other things. It has a timestamp column which I'd like to use to show the route in which the tractor drove through the field via a ...
2
votes
6answers
174 views

Rule based coloured background for labeling in QGIS

I am a newbie working on QGIS 3.6 / Windows 10. I need to label a polygon layer which is categorised by colour. (pls refer to attached pic as a graphical reference) The labels need to have a ...
2
votes
2answers
67 views

Displaying 2 different color lines based on 2 different table attributes in QGIS?

I have a line shapefile that has a bunch of data and it is broken down into different features which is assigned a different number. It is then styled on the rule based approach so each feature gets a ...
2
votes
2answers
279 views

QGIS Atlas map composition to show only points inside Polygon?

I want to create an atlas map where I have some 40 polygons, 100 points and 200 lines as different shapefile. Now I want to automate the atlas map preparation for each polygon and needs to show the ...
2
votes
1answer
135 views

Categorizing multiple values_multiple atributtes - QGIS 2.14

I have a problem with a polygon layer. Its an equipment and services layer... I want to aggregate different types of services in similar legend, like this: For example, these four : "Ensino ...
2
votes
1answer
258 views

Categorizing multiple entries in QGIS?

I am trying to categorize a polygon layer with several buildings, by the number of floors. I want to aggregate by classes like this way: 1 floor = 1 to 2 floors; 2 floors = 1 to 2 floors; 3 floors = ...
2
votes
1answer
26 views

Save Rule Based Symbology as Default Layer Style

I am constantly moving layers in and out of my projects, I was able to set default style for layers and they all the layers I drag and drop to my project get the same style by default. Lately I have ...
2
votes
1answer
70 views

Catching signal when rule toggles (active/inactive) using PyQGIS?

I would like to catch a signal when a rule within a rule based layer toggles visibility. How to permanently check this layer.renderer().rootRule().children()[0].active()==True the same way we can ...
2
votes
1answer
177 views

QGIS 3 - Variables in rule-based rendering?

I'll try and lay this out clearly, I have most of it covered, but there's a very specific thing I'm looking for in the rules - whether or not it can be done and if so, how? Key things I have done and/...
2
votes
1answer
365 views

Adding new rule by using QgsRuleBasedRenderer to existing one in PyQGIS?

I want to add new rules for a layer. However when I add them previous one(s) are deleted. Here is my code: layer = iface.activeLayer() symbol = QgsSymbol.defaultSymbol(layer.geometryType()) renderer =...
2
votes
1answer
28 views

How to find objects which are styled twice (in rule based styling) in QGIS 2.18.10

I have the problem of a complex rule based styling (with 10 different styles and multi-line rules in each style) with several thousands objects. My problem is that the sum of all styled objects in one ...
2
votes
1answer
573 views

Managing rule-based renderer in PyQGIS?

This is my first project in QGIS and I'm also quite new to Python. PyQGIS is more than a challenge for me! I found code in How to programmatically set a rule-based renderer in QGIS? to set a rule ...
2
votes
1answer
239 views

Is it possible to show all label on a polyline layer with minimum overlaps, by automatic changing of the font size?

My goal is the following: I would like to show every street name/label, without overlapping (the scale I use is <20000, and it is changing). The default label is curved, 8p, but if the software ...
2
votes
1answer
591 views

How to write a string based rule, e.g. If “Name” contains 'NRG'

I have created a field called 'Name' in QGIS and I wish to create a rule-based style for a gridded vector. The grids are either 'NEP1' or 'NEP1NRG' etc. with values to 5000+. I want a rule to colour ...
2
votes
2answers
164 views

Rotation field is missing in rule-based renderer in QGIS 2.6

I am trying to do rotation of point symbols in QGIS. I am working with rule-based renderer. In other types of classification there is a button advanced (for example in categorized renderer), where I ...
2
votes
1answer
141 views

Rule based styling with select-by-intersection syntax

I want to do rule based styling for a selection of gridded polygons dependent on their position relating to another layer. I want to show the polygon that a point feature based in an atlas falls ...
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 = @...
2
votes
1answer
219 views

Create rule-based renderer from an existing renderer using PyQGIS

I want to make a copy from an existing layer in the legend and render it with a rule-based renderer based on the original layer's graduated symbol renderer. Then I will change its rule expressions, ...
2
votes
1answer
394 views

Rule based polygon fill in QGIS?

I'm really quite new to QGIS, I want to style polygons fill with raster imagws based on a attribute contained in the property table. What do I have to write in the description in order to get for ...
2
votes
1answer
58 views

Possible to set color based on attribute while using 2.5D symbology?

I'm using 2.5D symbology to have my features display at different heights based on a certain attribute, but would also like the features displayed as different colors based on another attribute. Is ...
2
votes
1answer
82 views

QGIS raster rule-based coloring

I have a raster with different values (negative and positive). I want to color the raster based on a rule: All positive values have a certain color and all negative another. I don't want to use '...
2
votes
1answer
217 views

Qgis 2.18.14 - rulebased and categorized style in atlas

I am currently generating an atlas. I have four parts of a map, showed on each page. For the map I have a lot of polygons styled in different colours after category. Now I need to make a rulebased ...
2
votes
3answers
364 views

Rules within thematic maps in MapInfo

Is there a way to set specific rules when creating a thematic map in MapInfo? I would like to exclude the polygons that have too many of the items I want to represent from the thematic map (something ...
2
votes
1answer
219 views

Can I specify half-open scale ranges in rule-based QGIS layer styles?

In QGIS 2.16.1's rule-based symbology as well as in its rule-based labeling, it's possible to enable a "scale range" to which the visibility of the result of the respective rule (be it a symbology ...
2
votes
1answer
76 views

Rule-based rendering of one line with two line styles

I need to show parts of a network, which meet two criteria at the same time. So I would like to use the style of criteria 1 and the style of criteria 2 side by side (see picture). The problem is, that ...