Hi Guys-
Hate to bug you again. I downloaded a copy of uDig to see how the
reprojection works. Setting up a debug environment is not going to be as
straightforward as I had hoped. Before I embark on this endeavor, I have to ask
again - what is the proper why to reproject images using GeoTools? Pretty
please
:-)
Thanks!!
Peter
________________________________
From: Peter Borissow <[email protected]>
To: Andrea Aime <[email protected]>
Cc: Simone Giannecchini <[email protected]>;
[email protected]
Sent: Thu, March 17, 2011 7:29:56 AM
Subject: Re: [Geotools-gt2-users] Error Reprojecting Coverage to EPSG:900913
Hello Andrea/All-
I have attached an example of an image I am trying to reproject. The image
is just a plain jpeg returned from a wms. I would like to learn how to
transform
the image into another projection. Here's the code I am using to no avail.
-----
BufferedImage bi = ImageIO.read(
new File("C:/My Documents/earth.jpg"));
Envelope2D envelope = new Envelope2D(CRS.decode("EPSG:4326", true),
new java.awt.geom.Rectangle2D.Float(-180, -80, 360, 160)
);
GridCoverage2D gc2d = new GridCoverageFactory().create("BMImage", bi, envelope);
GridCoverage2D gc2dProj =
(GridCoverage2D)Operations.DEFAULT.resample(gc2d, CRS.decode("EPSG:3031"));
//EPSG:3031,EPSG:4326,EPSG:3409,EPSG:3410,EPSG:3412,EPSG:32761
ImageIO.write(gc2dProj.getRenderedImage(), "JPEG",
new File("/temp/reproject_out.jpg"));
-----
I get the same image out no matter which projection I choose. I am certain this
is operator error. Can you please point me in the right direction? Is there a
tutorial that I've missed? Should I download the source for uDig or GeoServer
and step through the debugger? Any guidance would be greatly appreciated!
Many Thanks,
Peter
________________________________
From: Peter Borissow <[email protected]>
To: Andrea Aime <[email protected]>
Cc: Simone Giannecchini <[email protected]>;
[email protected]
Sent: Wed, March 9, 2011 4:37:57 PM
Subject: Re: [Geotools-gt2-users] Error Reprojecting Coverage to EPSG:900913
Hello Andrea-
Thanks for your prompt reply. I must admit, I still don't understand why
the
input and output images are identical. The interior pixels representing
landmasses/oceans should be different when I go from WGS84 to Mercator.
Perhaps I need to take a different tact? Maybe I need to use a different set of
classes? Is there an article or post you can point me to?
Thanks!
Peter
________________________________
From: Andrea Aime <[email protected]>
To: Peter Borissow <[email protected]>
Cc: Simone Giannecchini <[email protected]>;
[email protected]
Sent: Wed, March 9, 2011 3:40:18 PM
Subject: Re: [Geotools-gt2-users] Error Reprojecting Coverage to EPSG:900913
On Wed, Mar 9, 2011 at 8:53 PM, Peter Borissow <[email protected]> wrote:
Hmm... I would have thought that the Google projection, like most mercator
projections, would have had warped features a little differently. For example,
Greenland would look radically different on a Mercator projection than a WGS84
"projection". Maybe I should try a different "world" projection to test whether
the reprojection is working? I tried a Robinson and Mollweide projection but
they seem to be unsupported (I can create an envelope but the coverage
transformation is bombing out). Anyone know of another global projection I can
test with? Just need an EPSG code to see if the coverage transformation is
working.
>
The Mercator does that, but the reprojection code does not unecessarily change
the image, in that case it just changes the world to image transformation, it's
not adding pixels.
In fact the code will always generate in image with the same number of pixels
as
the original one, it will change the pixel values as needed and change the grid
to world
transformation accordingly.
Mollweide and Eckert IV are supported in the latest source builds from trunk,
but they are not available on 2.6.x.
However Robinson is available since 2.6.3, though it does not have any
associated EPSG code (the EPSG database
hardly has any atlas worthy projection in, Mollweide, Eckert VI and Winkel
Tripel are also supported by GeoTools
trunk but don't have a EPSG code)
Cheers
Andrea
--
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 333 8128928
http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf
-------------------------------------------------------
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software
be a part of the solution? Download the Intel(R) Manageability Checker
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users