You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sedona.apache.org by "iGN5117 (via GitHub)" <gi...@apache.org> on 2023/07/28 22:06:02 UTC

[GitHub] [sedona] iGN5117 opened a new pull request, #933: [SEDONA-335] Add RS_PixelAsPoint

iGN5117 opened a new pull request, #933:
URL: https://github.com/apache/sedona/pull/933

   
   ## Did you read the Contributor Guide?
   
   - Yes, I have read [Contributor Rules](https://sedona.apache.org/latest-snapshot/community/rule/) and [Contributor Development Guide](https://sedona.apache.org/latest-snapshot/community/develop/)
   
   ## Is this PR related to a JIRA ticket?
   
   - Yes, the URL of the associated JIRA ticket is https://issues.apache.org/jira/browse/SEDONA-335. The PR name follows the format `[SEDONA-XXX] my subject`.
   
   ## What changes were proposed in this PR?
   - Add RS_PixelAsPoint
   
   
   ## How was this patch tested?
   - Added new tests
   
   
   ## Did this PR include necessary documentation updates?
   
   - Yes, I am adding a new API. I am using the [current SNAPSHOT version number](https://github.com/apache/sedona/blob/master/pom.xml#L29) in since `vX.Y.Z` format.
   


-- 
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: dev-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [sedona] jiayuasu commented on a diff in pull request #933: [SEDONA-335] Add RS_PixelAsPoint

Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu commented on code in PR #933:
URL: https://github.com/apache/sedona/pull/933#discussion_r1281089281


##########
common/src/main/java/org/apache/sedona/common/raster/RasterConstructors.java:
##########
@@ -96,10 +96,8 @@ public static GridCoverage2D makeEmptyRaster(int numBand, int widthInPixel, int
         // Create a new empty raster
         WritableRaster raster = RasterFactory.createBandedRaster(DataBuffer.TYPE_DOUBLE, widthInPixel, heightInPixel, numBand, null);
         MathTransform transform = new AffineTransform2D(scaleX, skewY, skewX, -scaleY, upperLeftX + scaleX / 2, upperLeftY - scaleY / 2);
-        GridGeometry2D gridGeometry = new GridGeometry2D(new GridEnvelope2D(0, 0, widthInPixel, heightInPixel), transform, crs);
-        ReferencedEnvelope referencedEnvelope = new ReferencedEnvelope(gridGeometry.getEnvelope2D());
         // Create a new coverage
         GridCoverageFactory gridCoverageFactory = CoverageFactoryFinder.getGridCoverageFactory(null);
-        return gridCoverageFactory.create("genericCoverage", raster, referencedEnvelope);
+        return gridCoverageFactory.create("genericCoverage", raster, crs, transform, null, null, null, null, null);

Review Comment:
   Since you modified the raster constructor, please check if new test cases should be added.



-- 
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: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [sedona] iGN5117 commented on a diff in pull request #933: [SEDONA-335] Add RS_PixelAsPoint

Posted by "iGN5117 (via GitHub)" <gi...@apache.org>.
iGN5117 commented on code in PR #933:
URL: https://github.com/apache/sedona/pull/933#discussion_r1279657687


##########
common/src/test/java/org/apache/sedona/common/raster/FunctionsTest.java:
##########
@@ -67,6 +67,15 @@ public void valueWithMultibandRaster() throws TransformException {
         assertEquals(255d, PixelFunctions.value(multiBandRaster, point(4.5d,4.5d), 4), 0.1d);
     }
 
+    @Test
+    public void testPixelAsPoint() throws FactoryException, TransformException {
+        GridCoverage2D emptyRaster = RasterConstructors.makeEmptyRaster(1, 5, 10, 123, -230, 8);
+        Geometry actualPoint = PixelFunctions.getPixelAsPoint(emptyRaster, 0, 0);

Review Comment:
   Added more tests



-- 
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: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [sedona] jiayuasu commented on a diff in pull request #933: [SEDONA-335] Add RS_PixelAsPoint

Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu commented on code in PR #933:
URL: https://github.com/apache/sedona/pull/933#discussion_r1278370685


##########
common/src/test/java/org/apache/sedona/common/raster/FunctionsTest.java:
##########
@@ -67,6 +67,15 @@ public void valueWithMultibandRaster() throws TransformException {
         assertEquals(255d, PixelFunctions.value(multiBandRaster, point(4.5d,4.5d), 4), 0.1d);
     }
 
+    @Test
+    public void testPixelAsPoint() throws FactoryException, TransformException {
+        GridCoverage2D emptyRaster = RasterConstructors.makeEmptyRaster(1, 5, 10, 123, -230, 8);
+        Geometry actualPoint = PixelFunctions.getPixelAsPoint(emptyRaster, 0, 0);

Review Comment:
   Please add a few more test cases that test different pixel locations.



-- 
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: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [sedona] jiayuasu merged pull request #933: [SEDONA-335] Add RS_PixelAsPoint

Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu merged PR #933:
URL: https://github.com/apache/sedona/pull/933


-- 
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: dev-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org