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

Viewshed: support observers to left and right of input raster #10264

Merged
merged 17 commits into from
Jun 25, 2024

Conversation

abellgithub
Copy link
Contributor

This adds support for observers to the left and right of the raster. Observers above and below the raster are not supported and providing such a location for an observer generates an error. It assumes that the space outside of the raster is empty (at a height below all cells in the raster).

Tests are included.

alg/viewshed.h Show resolved Hide resolved
return false;
}
if (!oOutExtent.contains(nX, nY))
{
CPLError(CE_Warning, CPLE_AppDefined,
Copy link
Member

Choose a reason for hiding this comment

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

do we need to issue a warning if this is nominally supported ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think so since it's a change in behavior from what exists. I don't think it hurts anything. It could be removed later.

{
CPLError(CE_Warning, CPLE_AppDefined,
"NOTE: The observer location falls outside of the DEM area");
//ABELL - Make sure observer Z is specified.
Copy link
Member

Choose a reason for hiding this comment

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

some check to add here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure. Normally the Z is zero by default and perhaps this is still fine.

/// Process the part of the first line to the left of the observer.
///
/// @param nX X coordinate of the observer.
/// @param iStart X coordinate of the first cell to the left of the observer to be procssed.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// @param iStart X coordinate of the first cell to the left of the observer to be procssed.
/// @param iStart X coordinate of the first cell to the left of the observer to be processed.

alg/viewshed.cpp Outdated Show resolved Hide resolved
@@ -29,59 +29,14 @@
###############################################################################

import os
import sys
Copy link
Member

Choose a reason for hiding this comment

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

it would be good if those changes to test_cli_utilities.py were put in a dedicated PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't realize those were in there until after I pressed the button. Are you OK with them as they are?

Copy link
Member

Choose a reason for hiding this comment

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

Actually, I'm afraid that's going to break Windows testing, because with MSVC builds, binaries go to $build_dir/apps/$config_name where config_name=Release, Debug, RelWithDebInfo, etc.
cmake/helpers/GdalSetRuntimeEnv.cmake tests care of correctly appending that directory in the PATH.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there some reason not to drive all this from cmake and avoid all of this? cmake knows where it stuck the binaries.

Copy link
Member

Choose a reason for hiding this comment

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

it is convenient to be able to run a single test file locally with pytest, without going through a whole test suite

Co-authored-by: Even Rouault <even.rouault@spatialys.com>
@rouault
Copy link
Member

rouault commented Jun 22, 2024

For CI to trigger, you also need to rebase on top of latest master to fix a conflict (likely related to 082d0e7)

@abellgithub
Copy link
Contributor Author

@rouault : I think issues have been addressed here.

@rouault
Copy link
Member

rouault commented Jun 24, 2024

I think issues have been addressed here.

you need to resolve #10264 (comment)

@rouault rouault merged commit 6899da0 into OSGeo:master Jun 25, 2024
35 checks passed
@abellgithub abellgithub deleted the viewshed-oor branch July 25, 2024 12:50
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.

2 participants