Automating vector data entry in QGIS

I would suggest Add autoincremental field tool in the QGIS Processing Toolbox > Vector table.

[Step 1] Draw a dummy line

Create a new line shapefile (in this example I have created a Lines layer, with only one line, which starts at the lowest point and ends at the highest point [a1]. [a2]. I have an id field, called fid (and it has only 1 line; i.e. "fid"= 1).

[Step 1.5] Choose contours which intersects the dummy line

enter image description here

(Expression)

intersects($geometry, geometry(get_feature('Lines', 'fid', '1')))

This expression returns new layer Matching features

[Step 2] Start Add autoincremental field tool

enter image description here

Make sure that the Input layer is your [Edit] selected contour layer, not the dummy line layer. Start value (1 m in the above example) should be the height of the first contour line it intersects.

(Expression)...[a3]

line_locate_point(geometry:=geometry(get_feature('Lines', 'fid', '1')),
 point:= intersection($geometry, geometry(get_feature('Lines', 'fid', '1'))))

[Step 3]

Open the attribute table of newly created Incremented layer and check the AUTO field. It seems your contour interval is 1, so you would not need further calculation. (If interval is 10m, then use the Field Calculator to multiply 10).

enter image description here

[Step 4] Repeat this process to cover whole area, then merge all output layers.


[a1] If you have already drawn the dummy line starting from the mountain top, then change the Sorting to descending. (Just tick off Sort ascending checkbox).

[a2] This line does not have to be straight.

[a3] This is just calculating the distance of intersecting contours, from the starting point of the line (along the line).


I could be wrong about the success of this approach, but I would think something like this would work:

  1. Identify an area of the map where contours are of even slope, ie they evenly spaced apart.

  2. Create a new line layer with just the boundary contours and give them their correct values

  3. Interpolate a grid with these boundary contours. Because they are evenly spaced, you should get a generally good surface. This may be a mess in some areas.

  4. Drape the contours to the grid.

  5. Round the values of the contour to an integer. You final output should be "good enough".

You can increase the resolution of the grid by feeding the interpolation method more contours.