Double quotes indicate that the string represents the name of an attribute while a single quote is a literal string.
So in your first case you get NULL because you don't have an attribute called something.
Here is the answer directly from QGIS help:
column name "column name" → Value of the field column name, take care
to not be confused with simple quote, see below
'string' → a string value, take care to not be confused with double
quote, see above
You should use the layers Metadata for it. In the Layers properties, fill in Attribution - Title string like shown below (you may use the Url too, as well):
Then insert the following expression into your label item (note the output preview in the screenshot and the arguments description of the layer_properties function on the right, you may access layer ...
Tested on QGIS 2.18 and QGIS 3.4
I can suggest using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer...
Let's assume we have three features in "buildings" and 12 in "point_layer" accordingly, see image below.
With the following Query, it is possible to achieve the result
Double marks refer to columns in the attribute table, single marks to a string value. E.g. CASE WHEN "something" > 100 THEN 'a lot' ELSE 'not so much' checks the size of integer values in your column and adds a string to fields in the attribute table based on that size.
Actually I cannot replicate the same behavior that you have. I created a grid with 0.5 degree width of latitude and longitude, and I round it to 2 decimal degree and it works fine. Then I added another column with a value of 50.49 and round it to 1 decimal and it worked as expected and I got 50.5. Here is the table with values:
I am not sure what was going ...
Thanks to the suggestion by @she_weeds, I found a much better solution. This method can be performed entirely in the Select by Expression tool, without creating any additional layers.
Use the collect function to combine the church points into a multipoint geometry. Use this multipoint geometry in the intersects function. Because we're using collect on a ...
The functions to extract temporal "parts" year(), month(), week(), day(), hour(), minute() and second() have a secondary function on intervals where they actually calculate the number of years, months, weeks and so on.
to_date('2019-12-31') - to_date('2019-01-01')
as there are that many days in that time interval.
You may be able to use Symbology, rather than Label.
(1) Choose Symbology tab and add two layers of Centroid fill with the Font marker type. Give negative offset (e.g. -10.0mm) to red, and positive offset (e.g. 10.0mm) to green.
(2) Highlight Font marker. Scroll down a little bit further, and click on the Data defined override (a small pull-down menu). ...
If the source is the layer name you could define your own custom function and use it as an expression in the label content dialog.
Click "Insert an Expression..." in the Main Properties of the label. Select the function editor tab and paste the following. Click "Save and Load Functions".
# Be sure to import iface from qgis.utils
from qgis.core import *
The default value is calculated before you enter the values for the other fields. Since the default value is calculated while those field values are NULL, none of the conditions are true. If you add an ELSE to the end of your CASE WHEN statement, you'll see that the field is always filled with the else value. The default value is not re-calculated when you ...
Also an expression example:
aggregate(layer:='point_layer', aggregate:='count', expression:="fid", filter:=intersects(buffer($geometry, 0.2), geometry(@parent)))
'point_layer' is your points
"fid" can be any field (e.g. "id")
Thanks to @Kazuhito and @Taras I found a aggregate way to check the intersection with the edges (nodes) of the buildings and the (control-) points, while the points will be buffered with 1m (green):
aggregate( 'point', 'count',"fid",intersects(buffer($geometry,1),nodes_to_points(geometry(@parent))))
As you can see: The building in the center have got 6 ...
When the Aggregate functions are getting you down, try RefFunctions.
Install the RefFunctions plugin. This adds a variety of useful custom functions to the expression builder, including geomnearest.
Retrieve target field value from the nearest target feature in target layer. Syntax: geomnearest(targetLayer,targetField)
The easiest way to do this would be to add a prefix like Plan0000_ to your layer names in the layers list and then set your symbology rules like this:
attribute( $currentfeature, left(@layer_name,8)) = 'fieldvalue' AND "whatever other filter"
This extracts the first 8 characters of your layer name (the plan name) and for each feature in the layer, queries ...
If you have many layers in your map and you would like to build the attribution label based on layers which are visible, it's possible with QGIS 3.4.
In QGIS 3.4, you can build your attribution label automatically, according to layers which are visible.
First, you need to setup metadata for all your layers.
In QGIS 3.4.0 or 3.4.4, you had to use the QGIS ...
left("Postcode", length("Postcode")-3) + ' ' + right("Postcode", 3)
It takes all characters of Postcode except the last three ones, adds a space and then appends the last three characters.
Edit.: I tested this in QGIS 2.18.22
You can try this formula applied on Data Defined Override near the size of the symbol and apply map units as in your case:
When @map_scale <=3000 then 37.5
When @map_scale > 3000 and @map_scale < 50000 then 50
when @map_scale >= 50000 then 75
You may need to define a symbol size between the 3000 and 50000 scales
The size of SVG ...
The IS NOT syntax can only be used with null but you have a '' (an empty string value delimited by quote) so the correct syntax should be uniqueid <> ''
I think this is because your field is a text field where null/none/empty value are stored as empty string (thus the '' in the value selector), in a numeric field you get "real" null value and could ...
You can evaluate each condition using if(), combine the outputs using ||, and remove the last slash using a regex expression:
regexp_replace( if("production"=1,'P/','') || if("office"=1,'O/','') || if("storage"=1,'S/',''),'/$','')
Note that this is more an enhanced comment, but will likely be edited to a qualified answer. I tried drawing a scetch of what is desired, with some resulting questions related to it (cp. my comment above):
For me, the question is what points are taken into account to gain a qualified statement on the "building quality".
point A is surely within the ...
There is no builtin function in QGIS field calculator that can do your task, but luckily you can create custom function in QGIS using Function Editor in field calculator, please follow the steps below
Open your shapefile in QGIS.
Open Attribute Table and click field calculator.
Please check the box saying Update existing field and select your desired field.
You can achieve the result that you are striving for with GRASS toolset v.clean for cleaning topology of a vector element. Probably, you will need to deploy rmdangle option.
rmdangle: remove dangles, threshold ignored if < 0
Check the following references for more details:
Removing 'tails' from line features?
Deleting lines in QGIS
Automated removal ...
You can easily add a new function to get array of z-values from line vertices.
Open Function Editor tab in Field Calculator (or Expression) window. Create a new function by clicking plus icon. Enter a file name, e.g. z_array_from_line.
Copy/Paste the script. Then, click Save and Load Functions (or related button) to register the function. It's added 'Custom'...
..I got it! I use this expression for a composer item label with 'insert expression':
aggregate(layer:='Corridors_86ef2ea9_d1a1_4d9f_9735_7b7b2fb54cb2', aggregate:='concatenate', expression:="Name", filter:=within($geometry, map_get( item_variables('Main Map'), 'map_extent')), concatenator:=', ')
Works like a charm:)