> ## 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.

# RS_GeoReference

Returns the georeference metadata of raster as a string in GDAL or ESRI format. Default is GDAL if not specified.

For more information about ScaleX, ScaleY, SkewX, SkewY, please refer to the [Affine Transformations](/reference/wherobots-db/raster-data/raster-affine-transformation) section.

<Note>
  If you are using `show()` to display the output, it will show special characters as escape sequences. To get the expected behavior use the following code:

  **Scala**

  ```scala theme={"system"}
  println(df.selectExpr("RS_GeoReference(rast)").sample(0.5).collect().mkString("\n"))
  ```

  **Java**

  ```java theme={"system"}
  System.out.println(String.join("\n", df.selectExpr("RS_GeoReference(rast)").sample(0.5).collect()))
  ```

  **Python**

  ```python theme={"system"}
  print("\n".join(df.selectExpr("RS_GeoReference(rast)").sample(0.5).collect()))
  ```

  The `sample()` function is only there to reduce the data sent to `collect()`, you may also use `filter()` if that's appropriate.
</Note>

<img src="https://mintcdn.com/wherobots/AayJA2u8CknIeTgt/images/sql-functions/RS_GeoReference/RS_GeoReference.svg?fit=max&auto=format&n=AayJA2u8CknIeTgt&q=85&s=6ed11d6b5cd0b916c20c5c879833ae2d" alt="RS_GeoReference" width="780" height="420" data-path="images/sql-functions/RS_GeoReference/RS_GeoReference.svg" />

## Signatures

```sql theme={"system"}
RS_GeoReference(raster: Raster, format: String = "GDAL")
```

## Parameters

<ParamField body="raster" type="Raster" required>
  The input raster.
</ParamField>

<ParamField body="format" type="String" default="&#x22;GDAL&#x22;">
  The output format. Either `"GDAL"` or `"ESRI"`. Defaults to `"GDAL"`.
</ParamField>

## Return type

<ResponseField type="String">
  A string representation.
</ResponseField>

## Examples

```
ScaleX
SkewY
SkewX
ScaleY
UpperLeftX
UpperLeftY
```

`ESRI`

```
ScaleX
SkewY
SkewX
ScaleY
UpperLeftX + ScaleX * 0.5
UpperLeftY + ScaleY * 0.5
```

```sql theme={"system"}
SELECT RS_GeoReference(ST_MakeEmptyRaster(1, 100, 100, -53, 51, 2, -2, 4, 5, 4326))
```

```
2.000000
5.000000
4.000000
-2.000000
-53.000000
51.000000
```

```sql theme={"system"}
SELECT RS_GeoReference(ST_MakeEmptyRaster(1, 3, 4, 100.0, 200.0,2.0, -3.0, 0.1, 0.2, 0), "GDAL")
```

```
2.000000
0.200000
0.100000
-3.000000
100.000000
200.000000
```

```sql theme={"system"}
SELECT RS_GeoReference(ST_MakeEmptyRaster(1, 3, 4, 100.0, 200.0,2.0, -3.0, 0.1, 0.2, 0), "ERSI")
```

```
2.000000
0.200000
0.100000
-3.000000
101.000000
198.500000
```
