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

Add support for cumulative viewshed #10674

Merged
merged 45 commits into from
Sep 5, 2024
Merged

Conversation

abellgithub
Copy link
Contributor

@abellgithub abellgithub commented Aug 28, 2024

This adds support for cumulative viewsheds.

I've changed the C++ interface from earlier a little bit, but it's trivial (some support structures were moved out of the Viewshed class and placed in a namespace and all classes were put in that same namespace). I don't think it will change again.

There is a doxygen error but I think that's because I moved the code into a subdirectory. Maybe doxygen is confused because the documentation exists.

@rouault
Copy link
Member

rouault commented Aug 28, 2024

There is a doxygen error but I think that's because I moved the code into a subdirectory. Maybe doxygen is confused because the documentation exists.

This is a spelling issue (spellchecking of doc is a recent addition in master): " source/programs/gdal_viewshed.rst:156: : Spell check: ulative: (CUM)ulative mode will create an eight bit raster the same size as the input raster"
So either change the wording, or tune doc/source/spelling_wordlist.txt

@rouault
Copy link
Member

rouault commented Aug 28, 2024

There is a doxygen error

ah sorry, there's one indeed actually. You likely need to tune the INPUT variable in the top Doxyfile

alg/viewshed/combiner.cpp Fixed Show fixed Hide fixed
alg/viewshed/combiner.cpp Fixed Show fixed Hide fixed
alg/viewshed/cumulative_viewshed.cpp Outdated Show resolved Hide resolved
}

GDALDriver *memDriver = GetGDALDriverManager()->GetDriverByName("MEM");
DatasetPtr dstDs(memDriver->Create(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dstDs should be checked against nullptr (memory allocation failure)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So cumulative viewshed requires a temporary in-memory raster of the size of the source raster ? That should perhaps be indicated in the documentation as a limitation.

alg/viewshed/cumulative_viewshed.cpp Outdated Show resolved Hide resolved
alg/viewshed/cumulative_viewshed.cpp Outdated Show resolved Hide resolved
Put source raster dataset creation in the right place.
@jratike80
Copy link
Collaborator

jratike80 commented Aug 29, 2024

I am not a license specialist, but if you have created new .cpp files which add new features maybe you could mention yourself as author.

I am curious, but by the added documentation I do not really understand what the result image will express. I found an example of hill tops https://intarch.ac.uk/journal/issue23/4/3.4.html, but what is the use case for a regular grid?

@rouault
Copy link
Member

rouault commented Aug 29, 2024

@abellgithub #10676 might be of interest (this should not block this PR from progressing, but might be an opportunity to rework it once the RFC has been merged)

@rouault
Copy link
Member

rouault commented Aug 30, 2024

I don't see currently any tests for the new mode?

@rouault
Copy link
Member

rouault commented Sep 5, 2024

@abellgithub ready to be merged?

@abellgithub
Copy link
Contributor Author

If you're OK with things, yes.

@rouault rouault added this to the 3.10.0 milestone Sep 5, 2024
@rouault rouault merged commit 33dd00c into OSGeo:master Sep 5, 2024
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants