Le 04/08/16 à 09:53, phuong hao nguyen thi a écrit :
> The present I haved 3 tag ModelPixelScaleTag, ModelTiepointTag,
> ModelTransformationTag and I haved wide image  and height image too ,
> So What would I do next ?

If you have ModelTransformationTag, I suggest to use that one. The other
tags will also need to be supported, but we can do that later.

According http://www.remotesensing.org/geotiff/spec/geotiff2.6.html this
tag should have 16 values of type 'double' (IEEE754). This value needs
to be stored in a matrix. The geotiff2.6.html page give the layout.
After you have read the double[] array from the GeoTIFF file, you can
use org.apache.sis.referencing.operation.matrix.Matrices.create(4, 4,
elements) method - but please read the javadoc for making sure that the
layout of the 'elements' array is the same than the layout of the
GeoTIFF array.

After you got a matrix, you can build a "math transform" from it using
org.apache.sis.referencing.operation.transform.MathTransforms.linear(matrix)
method. What you get is called "affine transform". If you are not
familiar with them, it may be worth to search "affine transform
tutorial" on Google. Affine transforms are very important in GIS and
there is many tutorial on the web about them.

After you got the transform, you can test it with a few points:

    DirectPosition pix = new DirectPosition2D(0, 0);    // Pixel coordinates
    DirectPosition geo = mt.transform(pix, null);
    System.out.println(geo);

Martin


Reply via email to