ArcGIS Runtime SDK for macOS

Viewshed (geoelement)


A viewshed shows the visible and obstructed areas from an observer's vantage point. This sample demonstrates how to attach a viewshed to a moving GeoElement.

Once the scene is done loading, click on a location for the tank to drive to. It will automatically turn and drive straight towards the clicked point. The viewshed will automatically move and rotate with the tank.

How it works

To attach a viewshed to an AGSGeoElement:

  1. Create an AGSGraphic and add it to an AGSGraphicsOverlay.
  2. Use an AGSSimpleRenderer in the AGSGraphicsOverlay which has a heading expression set. This way you can relate the viewshed's heading to the AGSGeoElement's heading.
  3. Create an AGSGeoElementViewshed with the graphic, heading/pitch offsets, and min/max distance.
  4. To offset the viewshed's observer location from the center of the graphic, set viewshed.offsetX, etc.

In this topic
  1. Description