Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grid_Terrain In absence of class 2 #350

Closed
nidhi23ug opened this issue Jun 11, 2020 · 11 comments
Closed

Grid_Terrain In absence of class 2 #350

nidhi23ug opened this issue Jun 11, 2020 · 11 comments
Assignees
Labels
Bug

Comments

@nidhi23ug
Copy link

@nidhi23ug nidhi23ug commented Jun 11, 2020

First just to mention, I have used liDR extensively all through my doctoral thesis and I can not thank you enough for such great and easy tools.

There has always been one issue that I wanted to raise is the issue of Grid_Terrain when there is no class 2. So one data provider did not follow LAS specifications and classified ground points in class 1 and 2 as unclassified points, and in some tiles, there are no unclassified points. So obviously in some tiles, there is no 2.

However, when I use class 1L for grid_terrain, for some tiles where 2L is missing I keep on getting "No ground points found. Impossible to compute a DTM." I have checked the source code and I think this is forced in even if class chosen for interpolation is different.

I know how to surpass it, I just kept Null class as 2 and I can still run it. But I wish I do not have to do it.

@nidhi23ug
Copy link
Author

@nidhi23ug nidhi23ug commented Jun 11, 2020

lidDat = readLAS(Path)
unique(lidDat@data$Classification)
#> [1] 6 1 8
dtm= lidR::grid_terrain(lidDat,res = 0.25,algorithm=knnidw(k=10L),use_class = c(1L))
#> Error: No ground points found. Impossible to compute a DTM.
@Jean-Romain
Copy link
Owner

@Jean-Romain Jean-Romain commented Jun 11, 2020

Try to use -change_classification_from_to 1 2 in filter. This will reclassify at read time

readLAS(path, filter = "-change_classification_from_to 1 2")
@Jean-Romain
Copy link
Owner

@Jean-Romain Jean-Romain commented Jun 11, 2020

Also

grid_terrain(lidDat,res = 0.25,algorithm=knnidw(k=10L),use_class = c(1L, 2L))

Should do the job no?

@nidhi23ug
Copy link
Author

@nidhi23ug nidhi23ug commented Jun 11, 2020

use_class = c(1L, 2L))

No, this one does not do, as there is no 2 class in some. Yes, reclassification does help. I already tried doing the reclassification and it worked fine.

@Jean-Romain
Copy link
Owner

@Jean-Romain Jean-Romain commented Jun 11, 2020

If there is no class 2 then only class 1 will be used. I don't understand why use_class = 1:2 cannot do the job.

@Jean-Romain Jean-Romain self-assigned this Jun 11, 2020
@nidhi23ug
Copy link
Author

@nidhi23ug nidhi23ug commented Jun 11, 2020

If there is no class 2 then only class 1 will be used. I don't understand why use_class = 1:2 cannot do the job.

Yes, this is precisely why I raised the issue. I could always reclassify but I didn't understand why it does not work.

`> lidDat = readLAS(Path)

unique(lidDat@data$Classification)
[1] 6 1 8
dtm= lidR::grid_terrain(lidDat,res = 0.25,algorithm=knnidw(k=10L),use_class = c(1L, 2L))
Error: No ground points found. Impossible to compute a DTM.`

@Jean-Romain
Copy link
Owner

@Jean-Romain Jean-Romain commented Jun 11, 2020

Ho ok I got it. Will see that tomorrow. It looks like a bug. Are you able to share a small file that I'll be able to use to reproduce.

@nidhi23ug
Copy link
Author

@nidhi23ug nidhi23ug commented Jun 11, 2020

Ho ok I got it. Will see that tomorrow. It looks like a bug. Are you able to share a small file that I'll be able to use to reproduce.

Yes sure, can I directly send it to you without keeping it public?

@Jean-Romain
Copy link
Owner

@Jean-Romain Jean-Romain commented Jun 11, 2020

As you wish

@Jean-Romain Jean-Romain added Bug and removed Feature request labels Jun 11, 2020
@Jean-Romain
Copy link
Owner

@Jean-Romain Jean-Romain commented Jun 11, 2020

Fixed. You can install from github or wait few more day I will release v3.0.1 soon.

The problem was that when I introduced use_class options I didn't remove a test consting in counting the point classified 2 to fail early in absence of point. This invalidated your specific use case.

Thank you for reporting

@nidhi23ug
Copy link
Author

@nidhi23ug nidhi23ug commented Jun 11, 2020

Fixed. You can install from github or wait few more day I will release v3.0.1 soon.

The problem was that when I introduced use_class options I didn't remove a test consting in counting the point classified 2 to fail early in absence of point. This invalidated your specific use case.

Thank you for reporting

Ah thank you so much for your quick action. Will do. Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.