1

I have quite a simple problem yet I can already guess the solution is going to be pretty complicated. I'm using QGIS and was wondering if there is a simple way for the computer to automatically assign height attributes to contours. The .kml file does not include height data and I don't have a .DEM file, but my source does have a .pdf to give a general idea of the contour layout. You can find it here: http://www.carpworld.co.za/index.php/dam-contours/boskop-dam. Say I set the height of the outside(highest) contour and the most inner(deepest) contour of the lake as well as the contour interval, I can see the plausibility. This is how the lake and the Attribute Table looks: enter image description here enter image description here

The features displayed in Attribute Table are points and the contour lines are not joined yet (One contour is not displayed as as one feature) they are still segmented lines and not polylines, so this is something to keep in mind.

So to summarize: I need a simple quick way to join the contours and assign height values to them in a somewhat automated process.

5
  • 1
    Do you still have the DEM? Where are the height values supposed to come from? It's usually not save to assume that height always decreases or increases
    – underdark
    Feb 26, 2019 at 19:01
  • 1
    The first method that came to my head is about getting DEM as raster or TIN as vector and then transporting elevations to your vector layer.
    – Taras
    Feb 26, 2019 at 19:02
  • 1
    This is an unusual request, because ready-made elevation contours generally come with elevation data included. In most cases it would be simpler to create contours for yourself than to re-assign elevation data to existing contours. Creating contours (with elevation data) from a DEM raster is a basic GIS task, and DEM rasters for most areas are available for free.
    – csk
    Feb 26, 2019 at 19:10
  • @csk All of you are asking and telling me the ideal would be to have a DEM, but actually that is my end goal: to have the DEM and create a 3D Mesh in Blender, but sadly I don't. What I do have is a PDF that gives a general idea of the contour layout. I'll put the link to my source in the question as I should probably have done to start with.
    – Janrich
    Feb 28, 2019 at 11:59
  • I wanted to make sure you're not doing things the hard way if you didn't have to. Thank you for editing your post to clarify that there's no DEM, which means that the usual/easy solution is not possible. Now the community can move on to try to find a creative solution to this unusual problem.
    – csk
    Feb 28, 2019 at 17:02

1 Answer 1

1

Note: As was discussed in the comments, this is an unusual situation. Usually you would either have depth measurements as points, or a DEM raster. Starting with depth measurements as points, you would interpolate them into a DEM, then use the DEM to generate contours.

In this case, the only data available is contours without depth measurements, and a pdf map with depth labels. For anyone who finds themselves in this situation, I strongly recommend searching for better data. Use the method below only after you've exhausted the possibility of finding proper data.

Here's a semi-automated method to apply known depth values to contours that came without depth values.

  1. Create a new line layer. It can be a temporary scratch layer. Draw a line that crosses from the outside (shoreline) contour to the deepest contour. (The direction of the line matters.) Choose a location where the cross line will increase in depth from start to finish, IE not crossing any areas where the lake get shallower.

    enter image description here

  2. Use the Line Intersection tool to get the points where the cross line crosses the contours.

    enter image description here

  3. Assign depth values to the intersection points with a calculation like:

    (-1 * (@row_number -1)) * conversionfactor
    

    The conversion factor is the spacing between the contours. To figure this out, count how many contour intervals there are from the shoreline to the deepest point (without crossing any rings). Divide this number by the depth of the lake. EG, my lake is 4m deep, and there are 4 intervals, so the contours are 1m apart, and my conversion factor is 1. (-1 * (@row_number -1)) * 1

    enter image description here

  4. Use the Join Attributes by Location tool to copy the depth values from the points to the contours. enter image description here

    Note: Joining by location failed to join any of the features. This might be a bug, but apparently the intersection points don't actually intersect with the contours (they should, but they don't). As a workaround, I used the NNJoin plugin to do a nearest-neighbor join.

    enter image description here

This creates a new layer of contours with depth values:

enter image description here

Note: If your contours are discontinuous, you'll need to repeat the process a few times until all the contours have depth values. Manually label contours in areas of shallow water surrounded by deeper water.

1
  • This is pretty ingenious. Nov 25, 2019 at 21:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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