Skip to main content
Computes the Local Outlier Factor (LOF) for each point in the input dataset. Local Outlier Factor is an algorithm for determining the degree to which a single record is an inlier or outlier. It is based on how close a record is to its k nearest neighbors vs how close those neighbors are to their k nearest neighbors. Values substantially less than 1 imply that the record is an inlier, while values greater than 1 imply that the record is an outlier.
ST_LocalOutlierFactor has a useSphere parameter rather than a useSpheroid parameter. This function thus uses a spherical model of the earth rather than an ellipsoidal model when calculating distance.
ST_LocalOutlierFactor

Signatures

ST_LocalOutlierFactor(geometry: Geometry, k: Int, useSphere: Boolean)

Parameters

geometry
Geometry
required
The input geometry.
k
Integer
required
The k value.
useSphere
Boolean
required
The use sphere value.

Return type

A numeric value.

Example

SELECT ST_LocalOutlierFactor(geometry, 5, true)
1.0009256283408587