3

In a heat island effect control project, I start from two point layers with the values of daytime and nighttime temperatures in degrees C:

'POINTS_DAY'

'POINTS_NIGHT'

These layers contain the "TEMP" field with the temperature values. I add an example screenshot:

enter image description here

I would like to calculate the temperature difference between Day and Night Temperature with the each nearest points where the measurements have been captured.

I use a Geometry Generator expression to visualize each nearest point of the POINTS_DAY layer to the POINTS_NIGHT layer by connecting the two points with a line. I achieve this with the following expression for Geometry Generator:

collect_geometries (
    array_foreach (
        overlay_nearest (
            'target_p', -- rename the layer if necessary
            $geometry,
            limit:=2
        ),
        make_line (
            $geometry,
            @element
        )
    )
)

enter image description here

My goal is to calculate the temperature substraction between each pair of nearby points, and fill the "DIFF" field of the POINTS_DAY layer with the substraction value.

1 Answer 1

8

We can do this with an update expression on the "DIFF" Field of the POINTS_DAY layer as follows:

TEMP - overlay_nearest(layer:='POINTS_NIGHT', expression:= TEMP, max_distance:= 500)[0]

i.e. Temperature value [TEMP] for the current day point minus [-] the temperature value [TEMP] for the nearest night point ['POINTS_NIGHT'] within 500 metres/units.

You can change the 500 to increase the search areas for the closest point.

Nearest Point Difference Value Expression

Nearest Point Difference Value

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.