3

I have a dataset of points with data at different depths:

e.g as a csv file as follows:

"ID","DEPTH","VALUE"

"BH01","0.5","10"

"BH01","2.0","50"

There will be multiple points with the same ID but different depths - how can I make QGIS only label the "ID" once? Have been banging my head with this for a while and can't figure it out.

2
  • 2
    Welcome to GIS.SE. Are you aware that duplicate geometries aren't best practice? If so, why did you choose to use them? Furthermore, how do you decide which value to use for a label, or which column would you want to use for a label?
    – Erik
    Commented Oct 25, 2019 at 8:35
  • Check out gis.stackexchange.com/questions/299788/…
    – MrXsquared
    Commented Oct 25, 2019 at 8:58

2 Answers 2

4

Here are a couple of simple solutions. I'm assuming points with the same ID are at nearly the same location.

  1. If the points with the same ID are supposed to be at the same location, try snapping them to exactly the same location with the one of the snap tools (snap geometries to layer or snap points to points).

    enter image description here

    When two points are in exactly the same place QGIS will usually only label one of them.

    enter image description here

  2. Use the point cluster rendering symbology type. This generates a symbol with two layers: a point marker and a font marker. Change the font marker portion of the symbol to display the ID field.

    enter image description here

It's worth noting (as Erik pointed out in the comments above) that duplicate geometries are not a best practice. It might be better to rearrange your data to have a single point at each location, and multiple depth fields for each point, eg "Depth1" "Depth2" "Depth3" etc. The snapping tools and the aggregate tools might be helpful for this.

1

If you have copied / pasted the items, their UID or ID, that you use to anchor the field through their attribute table, would be the same.

Solution: Using the field calculator, re-populate the null fields in the ID or UID that you use to anchor your label's, to create a separate (and therefore no longer duplicated) field. Use @row_number to re-number and give all fields a unique identifier.

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.