You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -23,6 +23,7 @@ We plan further enhancements to this feature (including automatic cleanup of che
23
23
-`RST_Clip` now exposes the GDAL Warp option `CUTLINE_ALL_TOUCHED` which determines whether or not any given pixel is included whether the clipping geometry crosses the centre point of the pixel (false) or any part of the pixel (true). The default is true but this is now configurable.
24
24
- Within clipping operations such as `RST_Clip` we now correctly set the CRS in the generated Shapefile Feature Layer used for clipping. This means that the CRS of the input geometry will be respected when clipping rasters.
25
25
- Added two new functions for getting and upcasting the datatype of a raster band: `RST_Type` and `RST_UpdateType`. Use these for ensuring that the datatype of a raster is appropriate for the operations being performed, e.g. upcasting the types of integer-typed input rasters before performing raster algebra like NDVI calculations where the result needs to be a float.
26
+
- Added `RST_AsFormat`, a function that translates rasters between formats e.g. from NetCDF to GeoTIFF.
26
27
- The logic underpinning `RST_MemSize` (and related operations) has been updated to fall back to estimating based on the raster dimensions and data types of each band if the raster is held in-memory.
27
28
-`RST_To_Overlapping_Tiles` is renamed `RST_ToOverlappingTiles`. The original expression remains but is marked as deprecated.
28
29
-`RST_WorldToRasterCoordY` now returns the correct `y` value (was returning `x`)
Copy file name to clipboardExpand all lines: docs/source/api/raster-format-readers.rst
+33-15Lines changed: 33 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,17 +98,27 @@ The output of the reader is a DataFrame with the following columns:
98
98
mos.read().format("raster_to_grid")
99
99
***********************************
100
100
Reads a GDAL raster file and converts it to a grid.
101
+
101
102
It uses a pattern similar to standard spark.read.format(*).option(*).load(*) pattern.
102
103
The only difference is that it uses :code:`mos.read()` instead of :code:`spark.read()`.
104
+
103
105
The raster pixels are converted to grid cells using specified combiner operation (default is mean).
104
106
If the raster pixels are larger than the grid cells, the cell values can be calculated using interpolation.
105
107
The interpolation method used is Inverse Distance Weighting (IDW) where the distance function is a k_ring
106
108
distance of the grid.
109
+
110
+
Rasters can be transformed into different formats as part of this process in order to overcome problems with bands
111
+
being translated into subdatasets by some GDAL operations. Our recommendation is to specify :code:`GTiff` if you run into problems here.
112
+
113
+
Raster checkpointing should be enabled to avoid memory issues when working with large rasters. See :doc:`Checkpointing </usage/raster-checkpointing>` for more information.
114
+
107
115
The reader supports the following options:
108
116
109
117
* fileExtension - file extension of the raster file (StringType) - default is *.*
110
118
* vsizip - if the rasters are zipped files, set this to true (BooleanType)
111
119
* resolution - resolution of the output grid (IntegerType)
120
+
* sizeInMB - size of subdivided rasters in MB. Must be supplied, must be a positive integer (IntegerType)
121
+
* convertToFormat - convert the raster to a different format (StringType)
112
122
* combiner - combiner operation to use when converting raster to grid (StringType) - default is mean
113
123
* retile - if the rasters are too large they can be re-tiled to smaller tiles (BooleanType)
114
124
* tileSize - size of the re-tiled tiles, tiles are always squares of tileSize x tileSize (IntegerType)
@@ -131,14 +141,19 @@ The reader supports the following options:
131
141
.. tabs::
132
142
.. code-tab:: py
133
143
134
-
df = mos.read().format("raster_to_grid")\
135
-
.option("fileExtension", "*.tif")\
136
-
.option("resolution", "8")\
137
-
.option("combiner", "mean")\
138
-
.option("retile", "true")\
139
-
.option("tileSize", "1000")\
140
-
.option("kRingInterpolate", "2")\
144
+
df = (
145
+
mos.read()
146
+
.format("raster_to_grid")
147
+
.option("sizeInMB", "16")
148
+
.option("convertToFormat", "GTiff")
149
+
.option("resolution", "0")
150
+
.option("readSubdataset", "true")
151
+
.option("subdatasetName", "t2m")
152
+
.option("retile", "true")
153
+
.option("tileSize", "600")
154
+
.option("combiner", "avg")
141
155
.load("dbfs:/path/to/raster.tif")
156
+
)
142
157
df.show()
143
158
+--------+--------+------------------+
144
159
|band_id |cell_id |cell_value |
@@ -151,14 +166,17 @@ The reader supports the following options:
151
166
152
167
.. code-tab:: scala
153
168
154
-
val df = MosaicContext.read.format("raster_to_grid")
0 commit comments