> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wherobots.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ST_GLocal

Runs Getis and Ord's G Local (Gi or Gi\*) statistic on the geometry given the `weights` and `level`.

Getis and Ord's Gi and Gi\* statistics are used to identify data points with locally high values (hot spots) and low
values (cold spots) in a spatial dataset.

The `ST_WeightedDistanceBand` and `ST_BinaryDistanceBand` functions can be used to generate the `weights` column.

## Signatures

```sql theme={"system"}
ST_GLocal(geom: Geometry, weights: Struct, level: Int)
```

## Parameters

<ParamField body="geom" type="Geometry" required>
  The input geometry.
</ParamField>

<ParamField body="weights" type="Struct" required>
  The weights value.
</ParamField>

<ParamField body="level" type="Integer" required>
  The level value.
</ParamField>

## Return type

<ResponseField type="Struct<G: Double, EG: Double, VG: Double, Z: Double, P: Double>">
  A struct containing the result fields.
</ResponseField>

## Example

```sql theme={"system"}
ST_GLocal(myVariable, ST_BinaryDistanceBandColumn(geometry, 1.0, true, true, false, struct(myVariable, geometry)), true)
```

```
{0.5238095238095238, 0.4444444444444444, 0.001049802637104223, 2.4494897427831814, 0.00715293921771476}
```
