jiayuasu commented on code in PR #993:
URL: https://github.com/apache/sedona/pull/993#discussion_r1311103563
##########
docs/api/sql/Raster-writer.md:
##########
@@ -9,6 +9,26 @@ To write a Sedona Raster DataFrame to raster files, you need
to (1) first conver
You can use the following RS output functions (`RS_AsXXX`) to convert a Raster
DataFrame to a binary DataFrame. Generally the output format of a raster can be
different from the original input format. For example, you can use
`RS_FromGeoTiff` to create rasters and save them using `RS_AsArcInfoAsciiGrid`.
+#### RS_Base64
+
+Introduction: Returns base64 encoded string of given raster.
+
+Since: `v1.5.0`
+
+Format: `RS_Base64(raster: Raster)`
+
+Spark SQL Example:
+
+```sql
+SELECT RS_Base64(raster) from rasters
+```
+
+Output:
+
+```
+iVBORw0KGgoAAAA...
Review Comment:
Fix here as well.
##########
common/src/main/java/org/apache/sedona/common/raster/RasterOutputs.java:
##########
@@ -101,4 +104,11 @@ public static byte[] asArcGrid(GridCoverage2D raster, int
sourceBand) {
public static byte[] asArcGrid(GridCoverage2D raster) {
return asArcGrid(raster, -1);
}
+
+ public static String asBase64(GridCoverage2D raster) throws IOException {
Review Comment:
Please add a test in Sedona-common to test it.
##########
sql/common/src/test/scala/org/apache/sedona/sql/rasteralgebraTest.scala:
##########
@@ -470,6 +470,12 @@ class rasteralgebraTest extends TestBaseScala with
BeforeAndAfter with GivenWhen
assert(writtenBinary1.length > writtenBinary2.length)
}
+ it("Passed RS_Base64") {
Review Comment:
This is not a correct output of Base64. I believe it should start with
"data:PNG". Please double check.
--
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]