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?

  • I think you vave to use two layers. As I understand your data source is csv or xls file? Then you can recalc source data and reload layer.
    – RainForest
    Commented Mar 15, 2023 at 8:23
  • 3
    No need for second layer. See solution below
    – Babel
    Commented Mar 15, 2023 at 8:32
  • Please, do not forget about "What should I do when someone answers my question?"
    – Taras
    Commented Mar 18, 2023 at 8:07

1 Answer 1


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')


  • Better to have x_surveyed is not NULL and y_surveyed is not NULL
    – Taras
    Commented Mar 18, 2023 at 8:08
  • Why that? This would only make sense if there is a value for y, but not for x. In such a case, no point can be created, so this case can be ignored.
    – Babel
    Commented Mar 18, 2023 at 16:40
  • Explicit is better than implicit
    – Taras
    Commented Mar 25, 2023 at 7:23
  • Short and simple is better than long and complicated ;-)
    – Babel
    Commented Mar 25, 2023 at 10:13

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.