I am trying to take a cylindrical file and reproject it to something
like polar stereographic. I also realize that there is much that I
don't know about mapping, datums, crs, etc. so I am hoping someone on
the list could give me a kick in the right general direction. I would
be more than happy to share whatever code sample I get working as a
contribution to the community.

So, here is what I have, and it generates an image, but it does not at
all resemble the original:

[For my testing I am using a Blue Marble image from
http://visibleearth.nasa.gov/view_rec.php?id=7100 which I resized down
for quicker processing]

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

BufferedImage bi = ImageIO.read(
   new File("F:/Temp/world.topo.bathy.200401.3x5400x2700.jpg"));

Envelope2D envelope = new Envelope2D(CRS.decode("EPSG:4326"),
   new Rectangle2D.Float(-180f, -90.0f, (float)bi.getWidth(),
      (float)bi.getHeight()));

GridCoverage2D gc2d = new GridCoverageFactory().create("BMImage", bi, envelope);

GridCoverage2D gc2dProj =
    (GridCoverage2D)Operations.DEFAULT.resample(gc2d,
        CRS.decode("EPSG:42301"));

ImageIO.write(gc2dProj.getRenderedImage(), "JPEG",
   new File("F:/Temp/reproject_out.jpg"));

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

As you can see, I am taking the raster image, creating an envelope
that defines it, creating the GridCoverage2D and then resampling it.
It seems too straight forward to actually work :-) so if anyone could
give me some guidance it would be much appreciated.

Kevin

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to