All Products
Search
Document Center

PolarDB:ST_ComputeViewShedSurface

Last Updated:Mar 28, 2026

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

ParameterTypeDescription
scsceneThe scene object to analyze.
viewpointcstringA 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:

FieldDescriptionExample value
xX coordinate of the observer's position.2938
yY coordinate of the observer's position.750
zZ coordinate (elevation) of the observer's position.90
hHeight offset added to the observer's elevation.1.8
azimuthHorizontal viewing direction in degrees.90
pitchVertical tilt of the view in degrees.-35
horizontalFovHorizontal field of view (FOV) in degrees.90
verticalFovVertical field of view (FOV) in degrees.60
distanceMaximum viewing distance from the observer's position.600
depthMapSizeResolution 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

image.png
  • Visible surface

image.png

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