iGN5117 commented on code in PR #1020:
URL: https://github.com/apache/sedona/pull/1020#discussion_r1327903814
##########
docs/api/sql/Raster-visualizer.md:
##########
@@ -20,7 +22,38 @@ Output:
iVBORw0KGgoAAAA...
```
-## Visualize a Raster band as a 2D matrix
+### RS_AsImage
+Introduction: Returns a HTML that when rendered using an HTML viewer or via a
Jupyter Notebook, displays the raster as a square image of side length
`imageWidth`. Optionally, an imageWidth parameter can be passed to RS_AsImage
in order to increase the size of the rendered image (default: 200).
+
+Since: `1.5.0`
+
+Format: `RS_AsImage(raster: Raster, imageWidth: int = 200)`
+
+Spark SQL Example:
+
+```sql
+SELECT RS_AsImage(raster, 500) from rasters
+SELECT RS_AsImage(raster) from rasters
+```
+Output:
+```html
+"<img
src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAECAAAAABjWKqcAAAAIElEQVR42mPgPfGfkYUhhfcBNw+DT1KihS6DqLKztjcATWMFp9rkkJgAAAAASUVORK5CYII=\"
width=\"200\" />";
+```
+
+!!!Tip
+ RS_AsImage can be paired with SedonaUtils.display_image(df) wrapper inside
a Jupyter notebook to directly print the raster as an image in the output,
where the 'df' parameter is the dataframe containing the HTML data provided by
RS_AsImage
+
+Example:
+```python
+df = sedona.read.format('binaryFile').load(DATA_DIR +
'raster.tiff').selectExpr(\"RS_FromGeoTiff(content) as raster\")
+htmlDF = df.selectExpr(\"RS_AsImage(raster, 500) as raster_image\")
+SedonaUtils.display_image(htmlDF)
+```
+
+
Review Comment:
Added image. Sorry!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]