ViewshedAnalysis enables the creation and display of viewshed and view dome type of visibility analysis in a 3D SceneView.
The analysis can contain multiple viewsheds. These can be created interactively or programmatically, and the analysis can be added directly to SceneView.analyses or to the ViewshedLayer.source in a SceneView.map.
const viewshed = new Viewshed({
observer: new Point({ }),
farDistance: 900,
heading: 64,
tilt: 84,
horizontalFieldOfView: 85,
verticalFieldOfView: 52
});
const viewshedAnalysis = new ViewshedAnalysis({
viewsheds: [viewshed],
});
// add the analysis to the view
view.analyses.add(viewshedAnalysis);
To add a viewshed interactively, use the ViewshedAnalysisView3D.place() method.
const abortController = new AbortController();
try {
// get a view for the analysis
const analysisView = await view.whenAnalysisView(viewshedAnalysis);
// start placing a new viewshed interactively
await analysisView.place({ signal: abortController.signal });
} catch (error) {
if (error.name === "AbortError") {
console.log("Placement operation was cancelled.");
}
}
// cancel the placement operation at some later point
abortController.abort();
To edit existing viewsheds interactively, set the ViewshedAnalysisView3D.interactive property true
and select a viewshed by hovering and clicking on their field-of-view manipulators.
// allow existing viewsheds in the analysis to be selected and edited
analysisView.interactive = true;
A ViewshedAnalysis can be persisted in a WebScene as part of a ViewshedLayer.
Known Limitations
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4