brycefrank / pyfor

Tools for analyzing aerial point clouds of forest data.
MIT License
93 stars 19 forks source link

Watershed segmentation #13

Closed ccimarp closed 5 years ago

ccimarp commented 6 years ago

Hi Bryce,

I am running your script of watershed segmentation but I discover that before save the shapefile, the shapefile is rotated. I defined the projection but it haven't improved it. Could you help me?

Thanks! Carmen

brycefrank commented 6 years ago

Carmen,

This one is a bit tough to debug without your particular dataset. If it is possible to send me a sample via my contact (bfrank70@gmail.com) I should be able to help you. I have rerun the watershed segmentation sample with a different tile on my end and it behaves as expected.

If you want to try to debug it yourself I would first check to make sure that your_cloud.chm([your parameters]) returns a correctly oriented Ratser object.

brycefrank commented 6 years ago

Carmen,

A major breakthrough. I resolved the error in the watershed segmentation and produced a correctly oriented shapefile. I knew I would someday have to face my messy array handling. This will inspire some further cleanup for 0.2.2 so I will leave the issue open until that is implemented.

This line does all the work, and flips the canopy height model before the segmentation process begins: https://github.com/brycefrank/pyfor/blob/8493de34e15c8f466bfa5e9df8ad28dd69ea53ec/pyfor/rasterizer.py#L277

To update pyfor with the latest push to master, first change into your pyfor clone directory, pull from origin/master and reinstall:

git pull origin master
pip install .

This should proliferate the new update to your system.