[Geotools-gt2-users] Assistance with ImagePyramidReader

2008-04-16 Thread Kevin Ward
Hi,

Could some kind soul give me a nudge with regards to the
ImagePyramidReader? I have a pyramid already constructed but I want to
be able to retrieve a scaled image, not just the full-size. The brief
code I am using is:

ImagePyramidReader reader = new ImagePyramidReader(new File(PYRAMID_PATH));
GridCoverage2D grid = (GridCoverage2D)reader.read(null);
ImageIO.write(grid.getRenderedImage(), PNG,
new File(/home/pyramid-test/pyramid_out.png));

This results in a full-sized rendering of the pyramid. How do I
configure it to render something at 50% (for example)?

I am guessing that I need to feed GeneralParameterValues to
reader.read(...) but after looking through the javadocs and the
examples I am just not coming up with the solution.

Any assistance would be greatly appreciated, and I would be glad to
add the resulting snippet to the examples section of the site.

Thanks,

Kevin

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


Re: [Geotools-gt2-users] Assistance with ImagePyramidReader

2008-04-16 Thread Simone Giannecchini
Ciao Ken,
please, read below...

On Thu, Apr 17, 2008 at 12:45 AM, Kevin Ward [EMAIL PROTECTED] wrote:
 Hi,

 Could some kind soul give me a nudge with regards to the
 ImagePyramidReader? I have a pyramid already constructed but I want to
 be able to retrieve a scaled image, not just the full-size. The brief
 code I am using is:

 ImagePyramidReader reader = new ImagePyramidReader(new File(PYRAMID_PATH));
 GridCoverage2D grid = (GridCoverage2D)reader.read(null);
 ImageIO.write(grid.getRenderedImage(), PNG,
new File(/home/pyramid-test/pyramid_out.png));

 This results in a full-sized rendering of the pyramid. How do I
 configure it to render something at 50% (for example)?

You need to supply the reader with a gridgeometry that contains the
desired spatial region as an envelope and the target dimension of the
raster you wnat to obtain.
This will force the reader to do crop and subsample. You can check the
tests of the ImagePyramidReader class, specifically
ImagePyramidReaderTest.

A snippet can be found here:
http://pastebin.com/m3e506325

Which version of the code have you used to generate the pyramid?


Ciao,
Simone.



 I am guessing that I need to feed GeneralParameterValues to
 reader.read(...) but after looking through the javadocs and the
 examples I am just not coming up with the solution.

 Any assistance would be greatly appreciated, and I would be glad to
 add the resulting snippet to the examples section of the site.

 Thanks,

 Kevin

 -
 This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
 Don't miss this year's exciting event. There's still time to save $100.
 Use priority code J8TL2D2.
 http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
 ___
 Geotools-gt2-users mailing list
 Geotools-gt2-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users




-- 
---
Eng. Simone Giannecchini
President /CEO GeoSolutions S.A.S.
Via Carignoni 51
55041 Camaiore (LU)
Italy

phone: +39 0584983027
fax: +39 0584983027
mob: +39 333 8128928


http://www.geo-solutions.it

---

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


Re: [Geotools-gt2-users] Assistance with ImagePyramidReader

2008-04-16 Thread Kevin Ward
Ciao Simone!

Thank you very much! That was the nudge that I needed. I used
it.geosolutions.utils.imagepyramid.PyramidBuilder from the
modules/unsupported/coveragetools in 2.4.1 to generate my pyramid.

Kevin

On Wed, Apr 16, 2008 at 3:52 PM, Simone Giannecchini [EMAIL PROTECTED] wrote:
 Ciao Kevin,
  please, read below...


  On Thu, Apr 17, 2008 at 12:45 AM, Kevin Ward [EMAIL PROTECTED] wrote:
   Hi,
  
   Could some kind soul give me a nudge with regards to the
   ImagePyramidReader? I have a pyramid already constructed but I want to
   be able to retrieve a scaled image, not just the full-size. The brief
   code I am using is:
  
   ImagePyramidReader reader = new ImagePyramidReader(new File(PYRAMID_PATH));
   GridCoverage2D grid = (GridCoverage2D)reader.read(null);
   ImageIO.write(grid.getRenderedImage(), PNG,
  new File(/home/pyramid-test/pyramid_out.png));
  
   This results in a full-sized rendering of the pyramid. How do I
   configure it to render something at 50% (for example)?

  You need to supply the reader with a gridgeometry that contains the
  desired spatial region as an envelope and the target dimension of the
  raster you wnat to obtain.
  This will force the reader to do crop and subsample. You can check the
  tests of the ImagePyramidReader class, specifically
  ImagePyramidReaderTest.

  A snippet can be found here:
  http://pastebin.com/m3e506325

  Which version of the code have you used to generate the pyramid?


  Ciao,
  Simone.



  
   I am guessing that I need to feed GeneralParameterValues to
   reader.read(...) but after looking through the javadocs and the
   examples I am just not coming up with the solution.
  
   Any assistance would be greatly appreciated, and I would be glad to
   add the resulting snippet to the examples section of the site.
  
   Thanks,
  
   Kevin

  --
  ---
  Eng. Simone Giannecchini
  President /CEO GeoSolutions S.A.S.
  Via Carignoni 51
  55041 Camaiore (LU)
  Italy

  phone: +39 0584983027
  fax: +39 0584983027
  mob: +39 333 8128928


  http://www.geo-solutions.it

  ---


-- 
Kevin Ward
NASA Earth Observations (NEO)
Science Systems and Applications, Inc.
[EMAIL PROTECTED]
503-977-2970 (home)
Office Hours 7:30am-4pm Pacific Time
http://neo.sci.gsfc.nasa.gov/
http://earthobservatory.nasa.gov/

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


Re: [Geotools-gt2-users] Assistance with ImagePyramidReader

2008-04-16 Thread Simone Giannecchini
Ciao kevin,
please, let me know how it goes since I have some changes for pyramid
creation pending on my HD (sorry, only for gt-trunk) hence if you run
into any problems Iwould be glad to help you out.

Simone.

On Thu, Apr 17, 2008 at 1:11 AM, Kevin Ward [EMAIL PROTECTED] wrote:
 Ciao Simone!

 Thank you very much! That was the nudge that I needed. I used
 it.geosolutions.utils.imagepyramid.PyramidBuilder from the
 modules/unsupported/coveragetools in 2.4.1 to generate my pyramid.

 Kevin

 On Wed, Apr 16, 2008 at 3:52 PM, Simone Giannecchini [EMAIL PROTECTED] 
 wrote:
  Ciao Kevin,

   please, read below...
 
 
   On Thu, Apr 17, 2008 at 12:45 AM, Kevin Ward [EMAIL PROTECTED] wrote:
Hi,
   
Could some kind soul give me a nudge with regards to the
ImagePyramidReader? I have a pyramid already constructed but I want to
be able to retrieve a scaled image, not just the full-size. The brief
code I am using is:
   
ImagePyramidReader reader = new ImagePyramidReader(new 
  File(PYRAMID_PATH));
GridCoverage2D grid = (GridCoverage2D)reader.read(null);
ImageIO.write(grid.getRenderedImage(), PNG,
   new File(/home/pyramid-test/pyramid_out.png));
   
This results in a full-sized rendering of the pyramid. How do I
configure it to render something at 50% (for example)?
 
   You need to supply the reader with a gridgeometry that contains the
   desired spatial region as an envelope and the target dimension of the
   raster you wnat to obtain.
   This will force the reader to do crop and subsample. You can check the
   tests of the ImagePyramidReader class, specifically
   ImagePyramidReaderTest.
 
   A snippet can be found here:
   http://pastebin.com/m3e506325
 
   Which version of the code have you used to generate the pyramid?
 
 
   Ciao,
   Simone.
 
 
 
   
I am guessing that I need to feed GeneralParameterValues to
reader.read(...) but after looking through the javadocs and the
examples I am just not coming up with the solution.
   
Any assistance would be greatly appreciated, and I would be glad to
add the resulting snippet to the examples section of the site.
   
Thanks,
   
Kevin
 
   --
   ---
   Eng. Simone Giannecchini
   President /CEO GeoSolutions S.A.S.
   Via Carignoni 51
   55041 Camaiore (LU)
   Italy
 
   phone: +39 0584983027
   fax: +39 0584983027
   mob: +39 333 8128928
 
 
   http://www.geo-solutions.it
 
   ---
 

 --
 Kevin Ward
 NASA Earth Observations (NEO)
 Science Systems and Applications, Inc.
 [EMAIL PROTECTED]
 503-977-2970 (home)
 Office Hours 7:30am-4pm Pacific Time
 http://neo.sci.gsfc.nasa.gov/
 http://earthobservatory.nasa.gov/




-- 
---
Eng. Simone Giannecchini
President /CEO GeoSolutions S.A.S.
Via Carignoni 51
55041 Camaiore (LU)
Italy

phone: +39 0584983027
fax: +39 0584983027
mob: +39 333 8128928


http://www.geo-solutions.it

---

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users