5

In QGIS 3.26.3 Buenos Ares I have a set of drill hole point data with XY fields for the planned drill hole location and a second set of fields for the surveyed XY location after drilling.

I want to visualise these data using the surveyed location as the primary, but in the event that the surveyed data doesn't exist (the hole hasn't been drilled/surveyed yet) i'd like QGIS to read from the planned drill hole field. Is this possible to achieve within a single layer? Or do I have to create two layers, one for each criterion?

Taras
  • 32,823
  • 4
  • 66
  • 137
MBorgC
  • 51
  • 1

1 Answers1

11

Use a Geometry Generator style for your point layer with an expression that creates a point based on x/y coordinate values for surveyed locations if it exists and else create a point based on x/y coordinate values for planned locations.

This expression does this based on field names of coordinate attributes called x_surveyed/y_surveyed and x_planned/y_planned respectively:

if (
    x_surveyed is not NULL,
    make_point(x_surveyed, y_surveyed),
    make_point(x_planned, y_planned)
)

Screenshot: red = surveyed, blue = planned holes (here with a slightly different expression, using case...when condition - it works the same): enter image description here

You could also use two different symbol layers of Geometry Generator type (one for planning, one for surveyed locations) and apply a different style for each. Or use one symbol layer with the solution from above, but define a data-defined override for the color, something like:

if(x_surveyed is not NULL, 'red', 'blue')

References:

Taras
  • 32,823
  • 4
  • 66
  • 137
Babel
  • 71,072
  • 14
  • 78
  • 208