BTW, I did try EPSG:3875 and I get the following error:

NoSuchAuthorityCodeException: No code "EPSG:3875" from authority "European 
Petroleum Survey Group"

I don't think that's a real code. I don't see it in my EPSG database. Also not 
on spatialreference:
http://spatialreference.org/ref/epsg/3875/

Is there another code I should try instead? Any other suggestions?

Thanks!





----- Original Message ----
From: Peter Borissow <[email protected]>
To: Simone Giannecchini <[email protected]>
Cc: John Poole <[email protected]>; [email protected]
Sent: Fri, March 25, 2011 4:46:32 PM
Subject: Re: [Geotools-gt2-users] Error Reprojecting Coverage to EPSG:900913

Ciao!

This image is what I generated using EPSG:900913:

http://www.javaxt.com/download/?/images/temp/reproject_900913.jpg

The southern hemisphere looks OK (not convinced its right). The northern 
hemisphere doesn't look anything like what I would expect. Features in higher 
latitudes should be stretched out (e.g. Greenland). Something like this:

http://en.wikipedia.org/wiki/File:Mercator-projection.jpg


Peter




----- Original Message ----
From: Simone Giannecchini <[email protected]>
To: Peter Borissow <[email protected]>
Cc: John Poole <[email protected]>; [email protected]
Sent: Fri, March 25, 2011 2:20:23 PM
Subject: Re: [Geotools-gt2-users] Error Reprojecting Coverage to EPSG:900913

Ciao Peter,
one advice, I would use EPSG:3875 rather than EPSG:900913.

Question, what do you mean by "the output doesn't look right"?

Regards,
Simone Giannecchini
-------------------------------------------------------
Ing. Simone Giannecchini
GeoSolutions S.A.S.
Founder

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/simonegiannecchini
http://twitter.com/simogeo

-------------------------------------------------------



On Fri, Mar 25, 2011 at 6:47 PM, Peter Borissow
<[email protected]> wrote:
> John-
>   Thanks for your reply. I got a little further along in the sense that I'm
> getting output images that differ from the input. Problem is that the output
> doesn't look right. Here's the code:
>
> ----
>
>
> BufferedImage bi = ImageIO.read(
>   new File("/temp/earth.jpg"));
>
> int epsg = 900913; //3395,3031,4326,3409,3410,3412,32761
> CoordinateReferenceSystem crs = CRS.decode("EPSG:" + epsg );
> GeographicBoundingBoxImpl bbox;
> if (crs.getDomainOfValidity()==null){ //<-- "EPSG:900913" is not returning
> extents
>    bbox = new GeographicBoundingBoxImpl();
>    bbox.setWestBoundLongitude(-180);
>    bbox.setEastBoundLongitude(180);
>    bbox.setNorthBoundLatitude(80);
>    bbox.setSouthBoundLatitude(-80);
> }
> else{
>    java.util.Iterator it =
>    crs.getDomainOfValidity().getGeographicElements().iterator();
>    bbox = (GeographicBoundingBoxImpl) it.next();
> }
>
>
>
> Envelope2D envelope = new Envelope2D(CRS.decode("EPSG:4326", true),
>    new java.awt.geom.Rectangle2D.Double(
>    bbox.getWestBoundLongitude(),
>    bbox.getSouthBoundLatitude(),
>    bbox.getEastBoundLongitude(),
>    bbox.getNorthBoundLatitude())
> );
>
> GridCoverage2D gc2d = new GridCoverageFactory().create("BMImage", bi, 
>envelope);
>
> GridCoverage2D gc2dProj =
>    (GridCoverage2D)Operations.DEFAULT.resample(gc2d, crs);
>
> ImageIO.write(gc2dProj.getRenderedImage(), "JPEG",
>   new File("/temp/reproject_" + epsg + ".jpg"));
>
>
> ---
>
> It seems like the Envelope2D I'm defining is wrong. I've tried several other
> projections including 3395, 54004, and 3031with no luck.
>
>
> Here are the input and output images:
> http://www.javaxt.com/download/?/images/temp/earth.jpg
> http://www.javaxt.com/download/?/images/temp/reproject_900913.jpg
>
>
>
> Thanks Again,
> Peter
>
>
>
>
> ----- Original Message ----
> From: John Poole <[email protected]>
> To: [email protected]
> Sent: Thu, March 24, 2011 11:04:38 AM
> Subject: Re: [Geotools-gt2-users] Error Reprojecting Coverage to EPSG:900913
>
> The method you're using looks right. Are all the coordinates valid for
> the projections you're using?
>
> i.e.
>
> "EPSG:4326"   , Rectangle2D.Float(-180, -80, 360, 160)
>
>
> On Thu, Mar 24, 2011 at 4:56 AM, Peter Borissow
> <[email protected]> wrote:
>> 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
>
>
>
>
> ------------------------------------------------------------------------------
> 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
>


      

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

Reply via email to