Jérémy DE ROYER a écrit :
The (last ?) problem I (still) have is that I get wrong y coordinates. The
x ones seems to be right. It's not a problem to display the rasters alone
but it's a problem to localize and to use rasters with vectors.
This happen often with raster. Output devices like screen usually put
the (0,0) coordinates in the upper left corner, with y values increasing
down. Some data put their (0,0) corner in the lower left corner, with y
values increasing up. The convention used by a particular image are not
always the same for all images.
I depends a lot which renderer you are using (lite-renderer?
j2d-renderer? yours own?). Some renderers swap the y axis direction for
every kind of data before rendering, because geographic data usually
have y values increasing up. If an image already have its (0,0)
coordinates in the upper left corder, sometime we need to instructs the
renderer of that.
J2D-renderer is suppose to handle images correctly. I don't know yet
about lite-renderer. I'm in the process of rewriting the J2D renderer as
a GO-1 implementation (and trying to copy nice idea from lite-renderer
in the process), but it will take a while before it is ready. The work
is ungoing in the ext/go module.
PROJCS["NTF (Paris) / France II",
[...snip...]
AXIS["x", EAST],
AXIS["y", NORTH]]
Sound nice. It would be nice to see the output of the following:
System.out.println(gridCoverage.getGridGeometry().getGridToCoordinateSystem());
It should be an affine transform. Paid special interest to the sign of
the "elt_1_1" element. Should be negative if it is necessary to swap the
y axis direction in order to get it oriented toward North, as indicated
in the WKT above. If the (0,0) coordinate is in the upper left corner of
the GeoTIFF image, then "elt_1_1" should be negative.
JLabel label = new JLabel();
label.setIcon(new ImageIcon(image));
label.setSize((int) largeur, (int) hauteur);
JFrame frame = new JFrame();
frame.add(label, BorderLayout.CENTER);
Sound like you use JLabel as a kind of renderer for the GridCoverage.
JLabel ignore completly the information provided by
getGridToCoordinateSystem(). If you want to render yours image yourself,
try the following instead:
Graphics2D g = ...
g.transform(...set the transform for rendering geographic data...);
AffineTransform at = (AffineTransform)
gridCoverage.getGridGeometry().getGridToCoordinateSystem();
d.drawImage(image, at);
(from memory; method signature may not be exactly that).
Martin.
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users