1

I have a two csv tables that have been related to eachother (RelatedResults):

Table 1 = Locations which is loaded as points Which has the fields[ID] [Type] [X] [Y]

Example: Point_1, Frogs, LAT, LONG

Table 2 = Results which is loaded as just an attribute table Which has the fields [ID] [Year] [ResultA] [ResultB]

Example:

Point_1, 2017, 2000, 4000

Point_1, 2018, 6000,150

I am trying to label the points based upon the year of sampling and every time I try to do it will only label using the result from 2017.

I have tried:

Filter

relation_aggregate( 'RelatedResults', 'count', CASE WHEN "Year" = '2018' THEN 'true' ELSE Null END )

Label Expression Generator

attribute(get_feature('Results', 'ID', ID), 'ResultA')

Not sure what I am doing incorrectly to get this to work as it will only ever show "2000" from the first year of results.

Any help would be amazing guys :). I have been stuck on this for a couple of days now. I need to produce concentration contours across a large areas for each year going back to 1985...

asked Feb 13, 2020 at 6:51
3
  • You can probably do it your way, but why no be free as a bird and use sql in a virtual layer: select t1.x,t1.y, t1.geometry, t2.year from table1 t1 inner join table2 t2 using (id). Assuming you have geometry in table1. BTW x is long not lat. Commented Feb 13, 2020 at 13:57
  • @Jakob. Thanks for that, I am not too great at SQL to write the inner join expression. Would I be able to have a hand with it? Thanks again! Commented Feb 17, 2020 at 6:29
  • @Jakob sorry I spoke too soon! Thank you so much for your help! I now just have to wrangle with the contouring addin. Thank you again Commented Feb 17, 2020 at 6:40

1 Answer 1

1

You can probably do it your way, but why not be free as a bird and use sql in a virtual layer:

select t1.x,t1.y, t1.geometry, t2.year 
from table1 t1 
inner join table2 t2 using (id)

Assuming you have geometry in table1. BTW x is long not lat.

A lot of data stuff in QGIS an be handled with a virtual layer. A lot easier to remember than where a dialog with 10 mouse clicks in it is hidden ...

Jochen Schwarze
15k8 gold badges56 silver badges124 bronze badges
answered Feb 18, 2020 at 12:39

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.