3

1. Question With Additional Information:

I would like to generate a sparsely packed layer containing points labelled with the Z-column of an existing interpolated TIN raster

A sample photograph what is needed is attached below,

Grid values overlaid over the interpolated layer - Image obtained using Surfer (Golden Software)

2. Background Information:

The following explains my process flow,

Step 1. Raw data in the form of .csv files; one of which contains

(i) depth measurements at various locations from, say, a water body, i.e., 3 columns of latitude, longitude, and altitude (altitude represents the Z-column described in the question), and the other.

(ii) boundary of the area covered previous explained in (i); again in latitude, longitude and Z-column form.

Step 2. Generate .shp files using OSGeo and GeoPandas - Python of items in Step 1 (along with the required CRS).

Step 3. Using TIN interpolation to generate raster of item described as (i) in Step 1.

Step 4. Use Clip Raster by Mask Layer to remove extents beyond the boundary described in (ii) in Step 1. The function, minimum bounding geometry is used to create the required mask layer from the boundary layer csv file.

3. Step of Interest Wherein the Question Asked Arises:

Step 5. I, now, use Pixels to Points to generate the point layer and further, add Labels->Single Labels-> Select the column containing the Z-column. However, the result obtained is very densely packed that the underlying layer is no longer visible. This is described in the image below,

enter image description here

How can I modify the density/ resolution/ the number of points to achieve a result close to that described in the Image in 1?

2
  • Create a new grid, drape (set z value from raster) – BERA Apr 25 at 9:53
  • Thank you for your comment. The only problem with creating a new grid with extents and setting a Z value using drape is that I am unable to find a way to clip off the points which don't fall within the layer clipped using Step 4 (using extents gives me only a rectangular shaped grid). – Ashish AJ Apr 25 at 14:40
2

I wrote a tutorial detailing an alternative to solve this problem but in spanish here https://acolita.com/etiquetado-inteligente-de-puntos-en-qgis-3/

I describe you the most important aspects

You can achieve what you want by setting a filter on the labels. Open the layer properties dialog box or the Layers > Symbology panel.

enter image description here

Set up a ruler-based symbology, for each ruler assign a filter using expressions and the scale ranges in which it will be visible. Set rulers for each scale range, points look close together at a small scale but separate at a larger scale, so you must assign rulers for each case.

enter image description here

For example, we can use the following option, using the id of each record. You write the following expression to display only each 25 points $id % 25 = 0

Assign as many rulers as you need considering the density of your points and evaluating how they look at different scales.

For the case of the example I developed use

  • Scales < 1:60.000 will be displayed every 25 points.
  • Scale between 1:60.000 and 1:25.000, will be shown every 20 points.
  • Scales between 1:25.000 and 1:10.000, displayed every 5 points
  • Scales larger than 1:10.000, all points are displayed.

enter image description here

The result looks like this

enter image description here

The dots remain with a fixed, regular spacing, you can try other expressions that give you a random effect, for example you can use the expression rand

there is a way to configure rules to achieve this result through the distance between two points?

If your points are irregularly scattered and you want to show only the points with neighboring points not too close to each other on a small scale

You can configure the rule filter with buffering for example, define a minimum distance threshold up to which you accept to see points close to that scale you can use an aggregate expression

Warning: this is very demanding and may take some time because the expressions are not optimized.

Parameters:

  • Point layer name: points
  • Distance threshold chosen: 100

Expression: aggregate(layer:='points', aggregate:='count', expression:=$id, filter:=intersects(buffer($geometry, 100,5), geometry(@parent))))

2
  • Thank you for your answer - your suggestions work well! However, it seems that my points are not regularly spaced and hence, the end-result is also not regularly spaced. Perhaps there is a way to configure rules to achieve this result through the distance between two points? – Ashish AJ Apr 25 at 12:46
  • 1
    Interesting question!!! if you can do it, you can do it with an added expression, I updated the answer with the details. I will update the blog article soon too :D – Luis Perez Apr 25 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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