[gdal-dev] GCPsToGeoTransform returns wrong values

Ari Jolma ari.jolma at gmail.com
Wed Nov 18 01:34:34 PST 2015


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 = new double[6];
>
> Gdal.GCPsToGeoTransform(gcps, geotransform, 0)
>
> Or (after using dataSet.SetGCPs(gcps, projection) :
>
> vargeotransform = new double[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 at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20151118/752505a4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 4160 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20151118/752505a4/attachment.png>


More information about the gdal-dev mailing list