Hi, the geotiff writer is swapping the axis order of gridcoverages in
WGS84. While I may understand intuitively the logic behind, this leads
to code like this[1], which is not very logic since the output is:

GeneralEnvelope[(-9.4, 35.200000348), (4.399999447999999, 43.9)]
GeneralEnvelope[(35.200000348, -9.4), (43.9, 4.399999447999999)]

I am using 9.1 version and I think the problem, if any, can be
reproduced with any kind of geotiff in wgs84.

Also, the written file appears rotated when I see it in QGIS. Is there
anything I am missing? Something wrong in my code?

Cheers.

[1]
        AbstractGridFormat format = GridFormatFinder
                .findFormat("/tmp/spain.tiff");
        AbstractGridCoverage2DReader reader = format
                .getReader("/tmp/spain.tiff");
        GridCoverage2D gc = reader.read(new GeneralParameterValue[0]);
        System.out.println(gc.getEnvelope());
        GeoTiffWriteParams params = new GeoTiffWriteParams();
        ParameterValue<GeoToolsWriteParams> value =
GeoTiffFormat.GEOTOOLS_WRITE_PARAMS
                .createValue();
        ParameterValue<Boolean> value2 = GeoTiffFormat.RETAIN_AXES_ORDER
                .createValue();
        value2.setValue(true);
        value.setValue(params);
        GeoTiffWriter writer = new GeoTiffWriter(new File("/tmp/spain2.tiff"));
        writer.write(gc, new GeneralParameterValue[] { value, value2 });
        writer.dispose();
        AbstractGridCoverage2DReader reader2 = format
                .getReader("/tmp/spain2.tiff");
        GridCoverage2D gc2 = reader2.read(new GeneralParameterValue[0]);
        System.out.println(gc2.getEnvelope());


--
Fernando González
http://geomati.co/

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to