Ciao Martin,
I think we can put things this way, if I try to crop a coverage
providing a very small envelope which fits inside the coverage's
envelope I think it would be advisable to return the smallest
coverage's area that contains the requested area. Of course, we should
adjust the envelope accordingly to such smallest raster area, but I
think that anyway we should avoid throwing an exception.
Moreover, this would probably be more in line with what JAI's Crop
operator does.


The same applies to the constructor for GeneralGridRange which has
this signature:

GeneralGridRange(final Envelope envelope, final PixelInCell anchor)

Let's assume I am doing this steps to crop a coverage

1> get the world-to-grid transform (I am assuming the grid-to-world is
a simple scale and translate hence we have a fairly simple case)
2> get a very small envelope completely contained in the original
envelope but which leads to a very small raster area. let's assume it
is represented by the rectangle2d  (minLon,minLat,lonSpa/4,latSpan/4).
3> transform the envelope using the world-to-grid transform in order
to get the corresponding raster area
4> create a GeneralGridRange for the just created envelope which
resides in the raster area

Well, with the given semantic I might get an error back since it might
really be that  w and/or h in the raster space are 0 after the
rounding you describe in the javadoc.
Same thing would not apply if we followed JAI's or
(rectangle2d.getBounds() if you like) approach.

What do you think about this issue?

Ciao,
Simone.

On Wed, Jul 23, 2008 at 4:25 PM, Martin Desruisseaux
<[EMAIL PROTECTED]> wrote:
> Hello Simone
>
> Simone Giannecchini a écrit :
>>
>> This little snippet is trying to crop a very small (1/3 of the pixel
>> width and height) part of a coverage around the lower left corner. If
>> you try to run this code you'll getn an exception from the Resample
>> operation.
>
> So if I'm understanding correctly, the expected result is an image of 1x1
> pixel in size?
>
> It sound reasonable to allow the code to return such image rather than
> throwing an exception. I never wrote a check for that because I didn't
> imagined that this case would occurs.
>
>        Regards,
>
>                Martin
>
>



-- 
-------------------------------------------------------
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 Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to