Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-29 Thread Michael Bedward
On 25 May 2010 19:11, Simone Giannecchini wrote: > > I would not mix up reprojection with resampling. I would do what follows: > > - if you are upsampling, first reproject than upsample > - if you are downsampling, first downsample then reproject. > Hi Simone, Since the operator allows users to r

Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-25 Thread Simone Giannecchini
performance --- Ing. Simone Giannecchini GeoSolutions S.A.S. Founder - Software Engineer Via Carignoni 51 55041 Camaiore (LU) Italy phone: +39 0584983027 fax: +39 0584983027 mob:+39 333 8128928 http://www.geo-solutions.it http://geo-s

Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-25 Thread Adnila
hey simone, thanks for your super fast answer. >- if you are upsampling, first reproject than upsample >- if you are downsampling, first downsample then reproject. what are the reasons for that different orders? can you tell me? -- View this message in context: http://osgeo-org.1803224.n2.nabb

Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-25 Thread Simone Giannecchini
Ciao Adnila, please read below --- Ing. Simone Giannecchini GeoSolutions S.A.S. Founder - Software Engineer Via Carignoni 51 55041 Camaiore (LU) Italy phone: +39 0584983027 fax: +39 0584983027 mob:+39 333 8128928 http://www.geo-so

Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-25 Thread Adnila
hey guys, can somebody give a tipp concerning resampling and reprojecting in one process? ^^ The coordinate reference system in combination with resampling is not working? Whats wrong? -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Rescale-GridCoverage2D-with-fixed-reso

Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-21 Thread Adnila
hey guys, I still have some problems, can you help? > GridEnvelope2D newGEnv = new GridEnvelope2D(0, 0, xDim, yDim); why is it zero? and not curGridEnv.x/curGridEnv.y? I have the following code snippet now: // initialize new processor and parameters crs = new CoordReferSyst();

Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-20 Thread Michael Bedward
Hi Jon, Linda, Yep, it sounds like you're both on the road to grid coverage happiness now :) Linda: for any desired cell width you can easily calculate the bits you need for the new GridGeometry2D object to pass to the Resample op... double cellSize = ... GridGeometry2D gg = cov.getGridGeometry

Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-20 Thread Jon Britton
I suppose you just find the ratio between the current cell size and the cell size you require, then use that for the scale factor. Or something like that anyway... Jon On 20 May 2010 17:30, Adnila wrote: > > hey guys, > > @Michael: thanks for the code. It was very helpful. You're the best ;-) >

Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-20 Thread Adnila
hey guys, @Michael: thanks for the code. It was very helpful. You're the best ;-) sry, when I caused some confusions. But I meant the cell width with resolution. This was not correct, sry. I need to set the cell width fixed. The user can chose the cell width in meters and than the new grid cover

Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-20 Thread Jon Britton
Hi Michael, This certainly answers my question, now I can do things the GeoTools way! Again, if you want a fixed resolution (say 800 x 600), since we're using scaling factors then the following should do the trick: // create new GridGeometry with half as many cells GridEnvelope2D newGridEnv = ne

Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-20 Thread Michael Bedward
Hi Linda, Jon, Sorry - didn't realize you were still stuck ! I hadn't been following the last few messages on this thread. If what you want to do is retain the coverage's world bounds but alter its resolution (ie. its grid bounds) you can do as in the code snippet below. Note that I'm not reproj

Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-20 Thread Jon Britton
Are you saying you want to make an image a given resolution, as in 800 x 600? For this I use the following method: public static RenderedImage rescale(RenderedImage image, int width, int height) { float xScale = (float) width / (float) image.getWidth(); float yScale = (float) height / (float) im

Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-20 Thread Adnila
hey guys, I still do not get it. can anybody help me please? here is my original post: Hey all, now I am trying to use a fixed resolution for a rescaling of a gridcoverage2D. The user should be able to choose a resolution from a GUI. What am I supposed to do if I want the rescaling with a fixed

Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-11 Thread Jody Garnett
Can you go through the ImageLab example? It should allow you to display something on the screen? You can use the same approach to make a MapContext that displays the image at the scale/resolution you desire. You can save the resulting image out. This is not recommended; the idea of resampling to

Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-11 Thread Adnila
I do not get what you mean. Can you explain it a little bit more. I am not such an expert with programming. That is why I am overwhelmed by your answer. -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Rescale-GridCoverage2D-with-fixed-resolution-tp5008772p5036177.html

Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-11 Thread Jody Garnett
Can you try cheating; setting up a rendering pipeline to render the coverage out at the requested scale; and then sample the resulting image? Jody On 06/05/2010, at 9:00 PM, Simone Giannecchini wrote: > Ciao Linda, > > if you want to change the resolution of a gridcoverage you need to > impose

Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-11 Thread Adnila
hey guys, I really do need some help. Is there anybody for helping me with this stupid rescale problem of gridcoverages? I do not get it fixed! -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Rescale-GridCoverage2D-with-fixed-resolution-tp5008772p5035536.html Sent from

Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-09 Thread Adnila
hey, what about the original topic? It seems that there is a strayed topic in here. does anybody have any idea how to solve the problem with rescaling a gridcoverage2D. thanks in advance. -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Rescale-GridCoverage2D-with-fixed-re

Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-06 Thread Adnila
hey, unfortunately it is not working. The result looks like this: (the given resolution was 100m) 0.0, 0.0, 0.0 100.0, 0.0, 0.0 200.0, 0.0, 0.0 300.0, 0.0, 0.0 400.0, 0.0, 0.0 before the resampling it looked like this: 4610500.0, 5675000.0, -5.2 4611500.0, 5675000.0, -5.3 4612500.0, 5675000.0

Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-06 Thread Simone Giannecchini
Ciao Linda, if you want to change the resolution of a gridcoverage you need to impose it using the resample operation.. On geotools trunk, I have put together this snippet: final double scaleX = 500; final double scaleY = 1000; final AffineTransform at = AffineTransform.

Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-06 Thread Adnila
hey, yes I saw this operation. But I do not really get how to manipulate the parameters to change resolution. It is always a little bit difficult to put everything together without some code snippets. Is there any example of changing resolution? I have to use real world units for the resolution f

Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-06 Thread Michael Bedward
Hi Linda, Have you seen the Resample operation ? You can control the resolution and the CRS... http://geotools.org/javadocs/org/geotools/coverage/processing/operation/Resample.html Michael -- __

Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-06 Thread Adnila
hey, > When you say rescale do you mean that you want to resample an existing > grid coverage at a new resolution or simply change the stated > resolution of the coverage without modifying its data ? I meant the first case: I want to resample an existing grid coverage at a new resolution with a n

Re: [Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-05 Thread Michael Bedward
Hi Linda, When you say rescale do you mean that you want to resample an existing grid coverage at a new resolution or simply change the stated resolution of the coverage without modifying its data ? Michael On 5 May 2010 23:29, Adnila wrote: > > Hey all, > now I am trying to use a fixed resolu

[Geotools-gt2-users] Rescale GridCoverage2D with fixed resolution

2010-05-05 Thread Adnila
Hey all, now I am trying to use a fixed resolution for a rescaling of a gridcoverage2D. The user should be able to choose a resolution from a GUI. What am I supposed to do if I want the rescaling with a fixed resolution for example from 500m to 1000m. I need a generic solution. At the moment I