-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dear list,
Thank you for your work you doing on the geotools library.
I use geotools-2.5.5 and try to resample a set triangulations into a
GeoTiff and have following problem. When I create the samples the
resulting tiff's should be spatial synchronized. That means if you patch
two tiffs together there should be no shift within the choosen raster
width and height. The construction of the coverage is made by an
Envelope2D and I've tested two constructors with the same strange
results. Neither the raster width nor the offset is in the resulting
tiff like I defined by the Envelope2D.

It works like this:


        CoordinateReferenceSystem dstCRS =
                CRS.decode("EPSG:" + dstEPSG, true);
        CoordinateReferenceSystem srcCRS =
                CRS.decode("EPSG:" + srcEPSG, true);

        // Recalculate the triangulation into the tatrger CRS
        if (srcEPSG != dstEPSG) {
            tringleList.transform(srcEPSG, dstEPSG);
        }
                // Now Envelope in the target CRS
        Envelope triEnv = tringleList.getEnvelope();

        // Raster envlope 2D synchronize the raster to
        // width and height by cropping

        long minX = (long)  (triEnv.getMinX()  / rasterWidth);
        minX *= rasterWidth;
        if (minX>triEnv.getMinX())  minX -= rasterWidth;

        long minY = (long)  (triEnv.getMinY()  / rasterHeight);
        minY *= rasterHeight;
        if (minY>triEnv.getMinY()) minY -= rasterHeight;

        long width = (long)  (triEnv.getWidth()  / rasterWidth);
        width *= rasterWidth;
        if (width<triEnv.getWidth()) width += rasterWidth;

        long height = (long) (triEnv.getHeight() / rasterHeight);
        height *= rasterHeight;
        if (height<triEnv.getHeight()) height +=rasterHeight;

        DirectPosition2D dpMin =
                     new DirectPosition2D(minX, minY);
        DirectPosition2D dpMax =
                     new DirectPosition2D(minX+width, minY+height);

        dpMin.setCoordinateReferenceSystem(dstCRS);
        dpMax.setCoordinateReferenceSystem(dstCRS);


        /*
        Envelope2D env =
          new Envelope2D(dstCRS, minX, minY, width, height);
        */
        Envelope2D env = new Envelope2D(dpMin,dpMax);

When I choose the rasterWidth=50m and rasterHeight=50m I get the minimum
values dpMin.X=4561850.0 dpMin.y=3476050.0 dpMax.x=4568000.0 and
dpMax.y=3481250.0 so every thing is fine and I get an offset position
and an cover width modulo  rasterWidth and rasterHeight.
But unfortunally the result is somthing like you see in the gdalinfo
dump. Neither the raster width 50m nor the offset is right.

Driver: GTiff/GeoTIFF
Files: S433846_84.bltz.3.tif
Size is 122, 103
Coordinate System is:
PROJCS["ETRS89 / ETRS-LAEA",
    GEOGCS["ETRS89",
        DATUM["European_Terrestrial_Reference_System_1989",
            SPHEROID["GRS 1980",6378137,298.2572221010002,
                AUTHORITY["EPSG","7019"]],
            AUTHORITY["EPSG","6258"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4258"]],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","3035"]]
Origin = (4561875.204918032512069,3481224.757281553465873)
Pixel Size = (50.409836065573771,-50.485436893203882)
Metadata:
  AREA_OR_POINT=Point
  TIFFTAG_XRESOLUTION=1
  TIFFTAG_YRESOLUTION=1
  TIFFTAG_RESOLUTIONUNIT=1 (unitless)
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  ( 4561875.205, 3481224.757)
Lower Left  ( 4561875.205, 3476024.757)
Upper Right ( 4568025.205, 3481224.757)
Lower Right ( 4568025.205, 3476024.757)
Center      ( 4564950.205, 3478624.757)

- --
Alexander Weidauer
    __________________ _    __      ______  ______
   /  _/ __/ ____/ __ \ |  / /     /  _/  |/  /   |
   / // /_/ / __/ / / / | / /_____ / // /|_/ / /| |
 _/ // __/ /_/ / /_/ /| |/ /_____// // /  / / ___ |
/___/_/  \____/_____/ |___/     /___/_/  /_/_/  |_|

Institut für Geodatenverarbeitung
Informationsdienste, -modelle und -applikationen
Tel.: 038333-527
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4-svn0 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFKK5XuMC1o6iopHygRAnCyAJ9qBrJGxX3VxDYmhrlKZtFxLcaS6gCfTk4i
EfdxTjrxb0yqrZvpGKLEyj8=
=GQSm
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to