On 18.11.2015 11:59, Bar Ori wrote:

Thanks Ari for your reply.

In my situation, sometimes I am working with rectangles and sometimes not. Depends the source of information.

I thought to always use the GCPs as follows:

In case my shape has rectangular form, so the dataSet.GetGCPCount() will return me “0” and I will use the dataSet.GetGeoTransform(), otherwise, will use the dataSet.GetGCPs().

The issue is that for setting the GCPs, I must put the coordinate in the middle of pixel (that is why I subtract “0.5”). If I wouldn’t, so yes, the geotransform values would be correct.

Is it a bad practice? Should I figure out the shape from start and to take two different steps?


I don't know the best answer to that. I'm just assuming if you do it with some GUI tool for example it will report you pixel coordinates in integer values.

Ari

*From:*gdal-dev [mailto:gdal-dev-boun...@lists.osgeo.org] *On Behalf Of *Ari Jolma
*Sent:* 18 November 2015 11:35
*To:* gdal-dev@lists.osgeo.org
*Subject:* Re: [gdal-dev] GCPsToGeoTransform returns wrong values

Bar,

I think you are setting the GCPs up wrongly if you want them to be at the corners.

GCP(LeftDown.X, LeftDown.Y, LeftDown.Z, Height - 0.5, null, "4") does not have 0 before Height-0.5.

GCPsToGeoTransform checks the special case of GCPs in rectangular shape and in top-left, top-right, bottom-right, bottom-left order and returns the exact transform the dataset has.

I'm not sure if it makes sense to have real values for the pixel coordinates although they are real values.

Best,

Ari

On 18.11.2015 09:32, Bar Ori wrote:

    Hi,

    I noticed something that for me looks weird and I would like to
    know maybe I am doing something wrong.

    If not, how should I overcome this behavior.

    I set 4 GCPs as follows:

    vargcps = new[]

    {

    newGCP(LeftUp.X, LeftUp.Y, LeftUp.Z, 0.5, 0.5, null, "1"),

    newGCP(RightUp.X, RightUp.Y, RightUp.Z, Width - 0.5, 0.5, null, "2"),

    newGCP(RightDown.X, RightDown.Y, RightDown.Z, Width - 0.5, Height
    - 0.5, null, "3"),

    newGCP(LeftDown.X, LeftDown.Y, LeftDown.Z, Height - 0.5, null, "4")

    };

    And when I am doing as follows:

    vargeotransform = newdouble[6];

    Gdal.GCPsToGeoTransform(gcps, geotransform, 0)

    Or (after using dataSet.SetGCPs(gcps, projection) :

    vargeotransform = newdouble[6];

    dataSet.GetGeoTransform(geotransform);

    So the values returned, are wrong.

    For example, if the LeftUp.X was 35.01050 so the value of
    geotransform[0], which supposed to be the same value, can be 35.0082.

    The same with all the geotransform values.

    If I am getting from the dataset and setting again, every time it
    is changing more and more.

    Is there any connection to the use of the “0.5”?

    Thanks.

    **

    **

        

    *Ori Bar |***Software Developer

    Applications Development

    Elbit Systems Land and C4I

    *T *+972-9-8898*900 **|****M***+972-504-734296

    **

    *The information in this e-mail transmission contains proprietary
    and business **
    *sensitive information.  Unauthorized interception of this e-mail
    may constitute *
    *a violation of law. If you are not the intended recipient, you
    are hereby *
    *notified that any review, dissemination, distribution or
    duplication of this *
    *communication is strictly prohibited. You are also asked to
    contact the sender *
    *by reply email and immediately destroy all copies of the original
    message.**




    _______________________________________________

    gdal-dev mailing list

    gdal-dev@lists.osgeo.org <mailto:gdal-dev@lists.osgeo.org>

    http://lists.osgeo.org/mailman/listinfo/gdal-dev

**
*The information in this e-mail transmission contains proprietary and business sensitive information. Unauthorized interception of this e-mail may constitute
a violation of law. If you are not the intended recipient, you are hereby
notified that any review, dissemination, distribution or duplication of this communication is strictly prohibited. You are also asked to contact the sender
by reply email and immediately destroy all copies of the original message.
*

_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to