I have a forest area, where I need to identify all the dividing lines between tree stands. I have a different amount of rastar files (RGB, NIR, DTM, DSM), and need an output with the boundaries as a shapefile. I would prefer if it came out as lines, but polygons is okay.

So, I need to identify the blue lines in the picture for a large forest area (the example is drawn from a normalized DSM, but I have other data available). These blue lines are just my quick drawing, but it needs to be more precise. The method does not need to be perfect, but identify the most significant changes in the vegetation.

enter image description here

  • Do you have access to training data for a predictive modeling approach? If so, how much?
    – Aaron
    Commented Sep 8, 2020 at 4:44

2 Answers 2


Your question is very broad but try some kind of segmentation, for example GRASS i.segment. Your raster is probably to high resolution. I tried with 1 m and 5 m:

  • i.segment
  • Vectorize
  • Convert to lines
  • Simplify

The combination of input parameters are infinite.

enter image description here


To complement the comment above, there is a number of ways that you may want to tackle this issue - most can be run from within QGIS. As mentioned above, the GRASS GIS tool i.segment is a very powerful tool.

In addition, another option is the segmentation tools (e.g. otbcli_Segmentation) available in the Orfeo Toolbox, which are described in detail here. These include the Mean Shift and Watershed segmentation algorithms and are very efficient, particularly for processing large images.

Although not a specific QGIS tool (and if you are using [LiDAR] derived products), you might consider using the R package, lidR and specifically the watershed segmentation routine, which is very clearly described here. Figure below is reproduced from the lidR github page :

enter image description here

  • 1
    The watershed segmentation in lidR will segment individual trees not forest stands. Another approach would be needed for that.
    – Aaron
    Commented Sep 8, 2020 at 4:24

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.