opengeos / lidar

A Python package for delineating nested surface depressions from digital elevation data.

Home Page:https://lidar.gishub.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong depression ID in outputted depressions.shp and level shapefiles

geotom opened this issue · comments

  • lidar version: 0.6.1 (Forced to use this one because of #21)
  • Python version: 3.8
  • Operating System: Ubuntu (Docker)

Description

When delineating depressions I use the following

sink_path = ExtractSinks(
    './test/dem.tif',
    1,
    './output'
)
DelineateDepressions(
    sink_path,
    1,
    0.5,
    0.2,
    './output'
    True
)

This runs through and produces me the general sinks (regions.shp) and the nested depressions (depressions.shp, depressions_info.csv). I understand the relation between both and want to assign to each region all the associated depressions and their geometries by looping through all the regions (ID's) and assigning them every depression (getting info from the depressions_info.csv). But I stumbled upon an issue where I cannot associate depressions by their IDs to the according poygon geometry, because the depressions.shp IDs are wrong. While I have enumerated all depressions correctly in the CSV file, the depressions shapefile has an very strange (and I assume wrong) numbering. At least most IDs fit, but I have for the level 1 depressions suddenly hundreds of depressions all having the depression ID 1. The rest of the polygons all have the correct depression ID, which relates tothe same ID in the depressions_info.csv file.

image

The same can be seen when looking at the individual level shapefiles. For level 1, I have a lot of polygons all with the same depression ID = 1

image

This does not allow to associate a geometry to a depression via its ID. I guess 1/50 or 1/100 of my depressions (and only those of level 1) have the wrong depression ID set to 1.

image

Do I misunderstand something or is this a bug in lidar? I assume, the polygons in level 1 are written to the shapefiles with an inccorect ID of 1 instead of the depression ID from the CSV file

The issue was probably caused by the raster-to-vector conversion. You should look at the file depression_id.tif, which should have the correct depression IDs. As can be seen from your vector, they are so many tiny polygons. You might want to consider adjusting the algorithm parameters to delineate only large depressions. Raster-to-conversion is beyond the scope of this package. It is a general problem that you will encounter with any GIS software when you have complicated raster datasets.

image

So this would explain these artefacts?
image

I just checked the depression_id.if which contains a lot of simple shaped features. All of the encircled raster areas have the ID = 1, and not the correct depression IDs.

Level ID should be 1, but depression ID should not be 1. Make sure you look at the correct raster file, there is one named depression_id.tif and one named level_id.tif

Yes I am looking exactly at depression_id.tif . When I compare the values of this raster with the depressions.shp they exactly match. So I doubt it comes from a raster polygonisation process.

image

So what I can observe is that in the CSV file, all depressions get an unique ID, but in all geographical output (shapefiles, geotiff), the values are set to ID = 1 for a lot of depressions.