Copilot commented on code in PR #383:
URL: https://github.com/apache/sedona-db/pull/383#discussion_r2572365162


##########
rust/sedona-raster-functions/src/rs_worldcoordinate.rs:
##########
@@ -0,0 +1,218 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+use std::{sync::Arc, vec};
+
+use crate::executor::RasterExecutor;
+use arrow_array::builder::Float64Builder;
+use arrow_schema::DataType;
+use datafusion_common::{error::Result, exec_err, ScalarValue};
+use datafusion_expr::{
+    scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, 
Volatility,
+};
+use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF};
+use sedona_raster::affine_transformation::to_world_coordinate;
+use sedona_schema::{datatypes::SedonaType, matchers::ArgMatcher};
+
+/// RS_RasterToWorldCoordY() scalar UDF implementation
+///
+/// Extract the rastertoworldcoordy of the raster
+pub fn rs_rastertoworldcoordy_udf() -> SedonaScalarUDF {
+    SedonaScalarUDF::new(
+        "rs_rastertoworldcoordy",
+        vec![Arc::new(RsCoordinateMapper { coord: Coord::Y })],
+        Volatility::Immutable,
+        Some(rs_rastertoworldcoordy_doc()),
+    )
+}
+
+/// RS_RasterToWorldCoordX() scalar UDF documentation
+///
+/// Extract the rastertoworldcoordx of the raster

Review Comment:
   The doc comment describes 'RS_RasterToWorldCoordX() scalar UDF 
documentation' but the phrase 'Extract the rastertoworldcoordx of the raster' 
is unclear. This should describe what the function does (e.g., 'Converts pixel 
coordinates to world X coordinate').
   ```suggestion
   /// Returns the upper left X coordinate of the given row and column in 
geometric units of the geo-referenced raster. If any out of bounds values are 
given, the X coordinate of the assumed point considering existing raster pixel 
size and skew values will be returned.
   ```



##########
rust/sedona-raster-functions/src/rs_worldcoordinate.rs:
##########
@@ -0,0 +1,218 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+use std::{sync::Arc, vec};
+
+use crate::executor::RasterExecutor;
+use arrow_array::builder::Float64Builder;
+use arrow_schema::DataType;
+use datafusion_common::{error::Result, exec_err, ScalarValue};
+use datafusion_expr::{
+    scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, 
Volatility,
+};
+use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF};
+use sedona_raster::affine_transformation::to_world_coordinate;
+use sedona_schema::{datatypes::SedonaType, matchers::ArgMatcher};
+
+/// RS_RasterToWorldCoordY() scalar UDF implementation
+///
+/// Extract the rastertoworldcoordy of the raster
+pub fn rs_rastertoworldcoordy_udf() -> SedonaScalarUDF {
+    SedonaScalarUDF::new(
+        "rs_rastertoworldcoordy",
+        vec![Arc::new(RsCoordinateMapper { coord: Coord::Y })],
+        Volatility::Immutable,
+        Some(rs_rastertoworldcoordy_doc()),
+    )
+}
+
+/// RS_RasterToWorldCoordX() scalar UDF documentation
+///
+/// Extract the rastertoworldcoordx of the raster
+pub fn rs_rastertoworldcoordx_udf() -> SedonaScalarUDF {
+    SedonaScalarUDF::new(
+        "rs_rastertoworldcoordx",
+        vec![Arc::new(RsCoordinateMapper { coord: Coord::X })],
+        Volatility::Immutable,
+        Some(rs_rastertoworldcoordx_doc()),
+    )
+}
+
+fn rs_rastertoworldcoordy_doc() -> Documentation {
+    Documentation::builder(
+        DOC_SECTION_OTHER,
+        "Returns the upper left Y coordinate of the given row and column of 
the given raster geometric units of the geo-referenced raster. If any out of 
bounds values are given, the Y coordinate of the assumed point considering 
existing raster pixel size and skew values will be returned.".to_string(),
+        "RS_RasterToWorldCoordY(raster: Raster)".to_string(),
+    )
+    .with_argument("raster", "Raster: Input raster")
+    .with_argument("x", "Integer: Column x into the raster")
+    .with_argument("y", "Integer: Row y into the raster")
+    .with_sql_example("SELECT RS_RasterToWorldCoordY(RS_Example(), 1, 
1)".to_string())
+    .build()
+}
+
+fn rs_rastertoworldcoordx_doc() -> Documentation {
+    Documentation::builder(
+        DOC_SECTION_OTHER,
+        "Returns the upper left X coordinate of the given row and column of 
the given raster geometric units of the geo-referenced raster. If any out of 
bounds values are given, the X coordinate of the assumed point considering 
existing raster pixel size and skew values will be returned.".to_string(),

Review Comment:
   The documentation description is misleading. The code (lines 39-43 in 
affine_transformation.rs) returns an error for out-of-bounds coordinates, but 
the documentation states 'the X coordinate of the assumed point... will be 
returned.' Update the documentation to reflect that out-of-bounds coordinates 
cause an error rather than computing an extrapolated value.



##########
rust/sedona-raster-functions/src/rs_worldcoordinate.rs:
##########
@@ -0,0 +1,218 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+use std::{sync::Arc, vec};
+
+use crate::executor::RasterExecutor;
+use arrow_array::builder::Float64Builder;
+use arrow_schema::DataType;
+use datafusion_common::{error::Result, exec_err, ScalarValue};
+use datafusion_expr::{
+    scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, 
Volatility,
+};
+use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF};
+use sedona_raster::affine_transformation::to_world_coordinate;
+use sedona_schema::{datatypes::SedonaType, matchers::ArgMatcher};
+
+/// RS_RasterToWorldCoordY() scalar UDF implementation
+///
+/// Extract the rastertoworldcoordy of the raster
+pub fn rs_rastertoworldcoordy_udf() -> SedonaScalarUDF {
+    SedonaScalarUDF::new(
+        "rs_rastertoworldcoordy",
+        vec![Arc::new(RsCoordinateMapper { coord: Coord::Y })],
+        Volatility::Immutable,
+        Some(rs_rastertoworldcoordy_doc()),
+    )
+}
+
+/// RS_RasterToWorldCoordX() scalar UDF documentation
+///
+/// Extract the rastertoworldcoordx of the raster
+pub fn rs_rastertoworldcoordx_udf() -> SedonaScalarUDF {
+    SedonaScalarUDF::new(
+        "rs_rastertoworldcoordx",
+        vec![Arc::new(RsCoordinateMapper { coord: Coord::X })],
+        Volatility::Immutable,
+        Some(rs_rastertoworldcoordx_doc()),
+    )
+}
+
+fn rs_rastertoworldcoordy_doc() -> Documentation {
+    Documentation::builder(
+        DOC_SECTION_OTHER,
+        "Returns the upper left Y coordinate of the given row and column of 
the given raster geometric units of the geo-referenced raster. If any out of 
bounds values are given, the Y coordinate of the assumed point considering 
existing raster pixel size and skew values will be returned.".to_string(),

Review Comment:
   The documentation description is misleading. The code (lines 39-43 in 
affine_transformation.rs) returns an error for out-of-bounds coordinates, but 
the documentation states 'the Y coordinate of the assumed point... will be 
returned.' Update the documentation to reflect that out-of-bounds coordinates 
cause an error rather than computing an extrapolated value.



##########
rust/sedona-raster-functions/src/rs_worldcoordinate.rs:
##########
@@ -0,0 +1,218 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+use std::{sync::Arc, vec};
+
+use crate::executor::RasterExecutor;
+use arrow_array::builder::Float64Builder;
+use arrow_schema::DataType;
+use datafusion_common::{error::Result, exec_err, ScalarValue};
+use datafusion_expr::{
+    scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, 
Volatility,
+};
+use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF};
+use sedona_raster::affine_transformation::to_world_coordinate;
+use sedona_schema::{datatypes::SedonaType, matchers::ArgMatcher};
+
+/// RS_RasterToWorldCoordY() scalar UDF implementation
+///
+/// Extract the rastertoworldcoordy of the raster

Review Comment:
   The doc comment describes 'RS_RasterToWorldCoordY() scalar UDF 
implementation' but the phrase 'Extract the rastertoworldcoordy of the raster' 
is unclear. This should describe what the function does (e.g., 'Converts pixel 
coordinates to world Y coordinate').
   ```suggestion
   /// Converts pixel coordinates (row and column) to the world Y coordinate in 
the geometric units of the geo-referenced raster.
   ```



-- 
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]

Reply via email to