Skip to content

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.

FunctionSyntax
Pythonset_extent(raster_col, xmin, ymin, xmax, ymax)
SQLRT_SetExtent(raster_col, xmin, ymin, xmax, ymax)
ScalasetExtent(raster, xMin, yMin, xMax, yMax)

For more details, go to the GeoAnalytics for Microsoft Fabric API reference for extent.

Examples

PythonPythonSQLScala
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9

from geoanalytics_fabric.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
Use dark colors for code blocksCopy
1
2
3
4
5
+---------------------------+---------------------------------------------------------------------------------------------+
|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

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.