Computes the visible surface from a viewpoint within a 3D scene object and returns the result as a meshgeom geometry.
Syntax
meshgeom ST_ComputeViewShedSurface(scene sc, cstring viewpoint);Return value
Returns a meshgeom object.
Parameters
| Parameter | Type | Description |
|---|---|---|
sc | scene | The scene object to analyze. |
viewpoint | cstring | A JSON string describing the observer's position and viewing angle. See Viewpoint JSON fields below. |
Viewpoint JSON fields
The viewpoint parameter uses the same JSON format as ST_ComputeFrustum. The following fields define the observer's position and field of view:
| Field | Description | Example value |
|---|---|---|
x | X coordinate of the observer's position. | 2938 |
y | Y coordinate of the observer's position. | 750 |
z | Z coordinate (elevation) of the observer's position. | 90 |
h | Height offset added to the observer's elevation. | 1.8 |
azimuth | Horizontal viewing direction in degrees. | 90 |
pitch | Vertical tilt of the view in degrees. | -35 |
horizontalFov | Horizontal field of view (FOV) in degrees. | 90 |
verticalFov | Vertical field of view (FOV) in degrees. | 60 |
distance | Maximum viewing distance from the observer's position. | 600 |
depthMapSize | Resolution of the internal depth map used for visibility computation. | 128 |
Description
ST_ComputeViewShedSurface calculates the visible surface (the visible triangular strip in the scene object) based on the specified scene object and viewpoint information.
The following figures show an example scene object and the corresponding visible surface computed from a viewpoint.
Scene object

Visible surface

Examples
Count the number of patches in the visible surface computed from a specific viewpoint:
SELECT ST_NumPatches(ST_ComputeViewShedSurface(scene, '{"x" : 2938, "y" : 750, "z" : 90, "h" : 1.8, "azimuth" : 90, "pitch" : -35, "horizontalFov" : 90, "verticalFov" : 60, "distance" : 600, "depthMapSize" : 128}')) from t;
--------
10451