A Vector Approach to Viewshed Analysis

Kailin Opaleychuk
Kailin Opaleychuk
  • Updated

FME Version

  • FME 2023.0


This article demonstrates how to conduct a spatial viewshed analysis in FME Form. Viewshed analysis determines visibility to and from a certain set of points using terrain. FME does not come with a standard viewshed tool, it requires a combination of transformers and processes. The following instructions will show you how to combine a billboard (tower) object with observer points to create sight lines. Sight Lines, also referred to as ‘Line of Sight’, are lines from an observer's eye to a distant point (reference). This is the common method of determining visibility between a tower and observer.

For new FME users, a vector approach to viewshed analysis may be simpler to understand, and easier to adjust for different scenarios. If analyzing hundreds to thousands of objects, this method should scale easily. 

Step-by-Step Instructions

Part 1: Define Billboard Object

1. Create Billboard Point
In FME Workbench, open a blank workspace. Using a Creator transformer, create a point feature for the billboard by entering an X and Y coordinate. Rename the Creation Instance to “Billboard”
    X: 514887.29
    Y: 5461675.85


2. Set a Coordinate System for Billboard Point
The data used in this article originates from the City of Coquitlam, in British Columbia. Therefore, data needs to be reprojected to the appropriate coordinate system. Add a CoordinateSystemSetter transformer and set the Destination Coordinate system to UTM83-10.


3. Convert Billboard Point to Ellipse
Although a point will be used during the analysis. An ellipse is more appropriate for visualization purposes.
Add a 2DEllipseReplacer to convert the point geometry to a two-dimensional ellipse. Set Center X to @XValue() and Center Y to @YValue(). These functions store the x and y coordinate value of each feature.


4. Force Billboard Elevation Over Terrain
Bring the billboard to the same elevation as the terrain. Add a 3DForcer, and set Elevation to 338.23. This will also convert the 2D billboard geometry to 2.5D.


5. Extract BillBoard Coordinates
Add a CoordinateExtractor and extract the billboard coordinates. Rename the output attributes in the parameters to include the term ‘billboard’ (eg.  “_x_billboard”). Repeat this for all values.


Part 2: Prepare Observer Points PART2.jpg

1. Read Building Data
Using a Shapefile Reader, read in the F11_Building_points.shp. Leave all parameters as default. The observers will be read as point features, representing individual buildings. The goal is to determine which buildings have an unobstructed view of the billboard. 


2. Create Building ID
Assign a unique ID to each building feature with a Counter. Set Count Start to 0, and the Output Attribute Name for Count to “ID”.


The Counter will create 2 dataflows. Add one connection from the output port of the Counter to the input port of the Offsetter. Add another connection from the Counter to the Left port of the FeatureJoiner.


3. Offset Observer Points
Elevate the observer points to 1.5 meters off the ground. It is unlikely Observers will be looking at the billboard from 0 elevation, but rather eye height. Set Z Offset to 1.5, leave all other parameters as default.


4. Transfer Billboard Point Location to Building Features
Copy the billboard coordinate attributes to each building point with a FeatureMerger. The output of the Offsetter is connected to the Requestor port. Next, connect the output of the CoordinateExtractor (from Part 1) to the Supplier port of the FeatureMerger.Within the FeatureMerger parameters, set Requestor to 1 and Supplier to 1. Select an Automatic Comparison Mode and the Feature Merge Type as Attributes Only.


5. Create Line of Sight Geometry
Add a VertexCreator to add a new billboard point on each building feature
X Value: _billboard_x
Y Value: _billboard_y
Z Value: _billboard_z


Notice how FME connects these two points, creating a 2D line of sight. 

6. Convert Line to 3D Pipe 
Because we are unable to clip a terrain surface with 2D lines, lines need to be converted to a 3D solid. A PipeReplacer can be used to convert the 2D line of sight geometry to a 3D pipe solid. This is required later on, when the pipes are clipped against the 3D terrain. Set the Outer Radius to 0.01


Part 3: Process Results

1. Read Raster DEM
Add a GeoTIFF reader. Read the provided raster F11_DEM_.tif, leaving all parameters default


2. Generate a TIN Surface
Using a TINGenerator, convert the raster DEM to a TIN surface. Set Surface Tolerance to 2. If the difference is greater than the tolerance specified then the point is added to the model and the TIN is recalculated to include this new point.


3. Clip TIN Surface with Line of Sight Solids
We need to determine if any building's line of sight intersects with the terrain. If a pipe intersects (clips) the surface, it means it was obstructed by it, hence, line ID is the ID of the building with no view. Enable ‘Merge Attributes’ within the Clipper parameters. Set Accumulation Mode to “Merge Clipper” and Conflict Resolution to “Use Clipper”. Leave all other parameters as default.


4. Find Unique IDs
Add a FeatureJoiner transformer. Connect the Inside output port of the Clipper to the Right input port of the FeatureJoiner. Next, connect the output port of the Counter (from Part 2) to the Left input port (see image).


Within the FeatureJoiner parameters, set Left to ID and Right to ID. Select an “Automatic” Comparison Mode.


5. Style Lines Based on Visibility
Add two FeatureColorSetters, connect one to the Joined and one to the Unjoined port of the FeatureJoiner. Buildings with billboard visibility will be output through the ‘Unjoined’ port, as they are unique or do not intersect the surface. Whereas, buildings without visibility will be passed through the ‘Joined’ port, this is because the building ID was matched with a Line ID from the Clipper, meaning the line intersected with the terrain (eg. no visibility). 


Results will look similar to the image below. 823 buildings are expected to have billboard visibility, where 116 buildings are not able to view the billboard.




Additional Resources


Data Attribution

The data used here originates from open data made available by the City of Coquitlam, British Columbia. It contains information licensed under the Open Government License.

Was this article helpful?



Please sign in to leave a comment.