Andrea Aime ha scritto:

> Now, I'm wondering, besides extending point sampling inside
> the original bbox (instead of using only the perimeter) do
> we have any smarter method? Even sampling inside the bbox
> we could loose part of the actual map area in 4326 if sampling
> did not happen to catch the pole...

Hum, found out CRS.transform(transorm, envelope) but it does not
seem to provide any improvement. Here is a little comparison:

import org.geotools.geometry.jts.JTS;
import org.geotools.geometry.jts.ReferencedEnvelope;
import org.geotools.referencing.CRS;
import org.opengis.geometry.Envelope;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.operation.MathTransform;

public class ReprojectEnvelopeTest {
     public static void main(String[] args) throws Exception {
         CoordinateReferenceSystem c3031 = CRS.decode("EPSG:3031", true);
         CoordinateReferenceSystem c4326 = CRS.decode("EPSG:4326", true);
         ReferencedEnvelope envelope = new 
ReferencedEnvelope(-3943612.4042124213,
                 3729092.5890516187, -4078471.954436003, 
4033483.085688618, c3031);
         MathTransform transform = CRS.findMathTransform(c3031, c4326);
         Envelope out = CRS.transform(transform, envelope);
         System.out.println(out);

         envelope = new ReferencedEnvelope(-3943612.4042124213, 
3729092.5890516187,
                 -4078471.954436003, 4033483.085688618, c3031);
         System.out.println(JTS.transform(envelope, transform));
     }
}

Results:

[-178,494 -88,991 , 137,562 -40,906]
Env[-178.49352310409273 : 163.97350610895933, -56.61747883535035 : 
-40.905775004205864]

Both are way off, the actual area covered by that 3031 envelope
is everything beneath a certain parallel, probably the -40° one,
towards the pole.

Sigh...
Cheers
Andrea


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to