Skip to main content
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 section.
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
println(df.selectExpr("RS_GeoReference(rast)").sample(0.5).collect().mkString("\n"))
Java
System.out.println(String.join("\n", df.selectExpr("RS_GeoReference(rast)").sample(0.5).collect()))
Python
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.
RS_GeoReference

Signatures

RS_GeoReference(raster: Raster, format: String = "GDAL")

Parameters

raster
Raster
required
The input raster.
format
String
default:"\"GDAL\""
The output format. Either "GDAL" or "ESRI". Defaults to "GDAL".

Return type

A string representation.

Examples

ScaleX
SkewY
SkewX
ScaleY
UpperLeftX
UpperLeftY
ESRI
ScaleX
SkewY
SkewX
ScaleY
UpperLeftX + ScaleX * 0.5
UpperLeftY + ScaleY * 0.5
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
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
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