I have a simple GridGeometry2D in Geotools 13.1 that is created like this: GridEnvelope grid = new GridEnvelope2D(0, 0, 100, 100); Envelope2D envelope = new Envelope2D(CRS.decode("EPSG:3857"), 10.0, 10.0, 1.0, 1.0); GridGeometry2D geom = new GridGeometry2D(grid, envelope);
For a quick test, I'm trying to find the grid coordinates for point (10.0, 10.0): DirectPosition out = geom.getCRSToGrid2D().transform( (DirectPosition) new DirectPosition2D(10.0, 10.0), (DirectPosition) new DirectPosition2D()); I expected the result for the x field to be 0.5 (since the default pixel anchoring mode is center), but instead this happened: DirectPosition2D[-0.5000000000001137, 99.5] I understand that the 99.5 is probably because the GridGeometry2D considers that y coordinates increase towards the north, but the GridEnvelope2D ycoordinates apparently increase towards the south (as it is common in image processing). What I don't understand is why the x coordinate is negative if the minimal x for my grid is 0. Why is this happening? *( Cross-posted from http://gis.stackexchange.com/questions/156514/in-geotools-why-does-reprojecting-the-origin-of-a-gridgeometry2d-results-in-off <http://gis.stackexchange.com/questions/156514/in-geotools-why-does-reprojecting-the-origin-of-a-gridgeometry2d-results-in-off> )*
------------------------------------------------------------------------------
_______________________________________________ GeoTools-GT2-Users mailing list GeoTools-GT2-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users