RT_SetExtent takes a raster column, four numeric values and returns a raster column. The four numeric values represent the minimum and maximum x,y-coordinates of an axis-aligned rectangle, also known as an envelope. The function updates the input raster's extent based on the specified coordinates.
| Function | Syntax |
|---|---|
| Python | set |
| SQL | RT |
| Scala | set |
For more details, go to the GeoAnalytics Engine API reference for extent.
Examples
from geoanalytics.raster import functions as RT
data = [(list(range(100)), )]
df = spark.createDataFrame(data, ["pixels"]) \
.withColumn("raster", RT.srid(RT.create_raster("pixels", 10, 10, "float32"), 4326))
df.select(RT.set_extent("raster", xmin=-122.57, ymin=47.34, xmax=-121.77, ymax=48.14).alias("set_extent")) \
.withColumn("extent", RT.extent("set_extent")).show(truncate=False)Result
+---------------------------+---------------------------------------------------------------------------------------------+
|set_extent |extent |
+---------------------------+---------------------------------------------------------------------------------------------+
|SqlRaster(1x10x10, Float32)|{"rings":[[[-122.57,47.34],[-122.57,48.14],[-121.77,48.14],[-121.77,47.34],[-122.57,47.34]]]}|
+---------------------------+---------------------------------------------------------------------------------------------+Version table
| Release | Notes |
|---|---|
2.0.0 | Python, SQL, and Scala functions introduced |