<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <br>
    <br>
    <div class="moz-cite-prefix">On 18.11.2015 11:59, Bar Ori wrote:<br>
    </div>
    <blockquote
cite="mid:538E9F517DECA94A86A940F00577EACDF836C971@MXHFA01.esl.corp.elbit.co.il"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <meta name="Generator" content="Microsoft Word 14 (filtered
        medium)">
      <!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
      <style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:DaxOT-Regular;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle23
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span style="color:#1F497D">Thanks Ari for
            your reply.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">In my
            situation, sometimes I am working with rectangles and
            sometimes not. Depends the source of information.<o:p></o:p></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="color:#1F497D">I thought to always use the GCPs as
            follows:<o:p></o:p></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="color:#1F497D">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().<o:p></o:p></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="color:#1F497D">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.<o:p></o:p></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="color:#1F497D">Is it a bad practice? Should I figure
            out the shape from start and to take two different steps?</span></p>
      </div>
    </blockquote>
    <br>
    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.<br>
    <br>
    Ari<br>
    <br>
    <blockquote
cite="mid:538E9F517DECA94A86A940F00577EACDF836C971@MXHFA01.esl.corp.elbit.co.il"
      type="cite">
      <div class="WordSection1">
        <p class="MsoNormal" style="text-autospace:none"><span
            style="color:#1F497D"><o:p></o:p></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="color:#1F497D"><o:p> </o:p></span></p>
        <div>
          <div style="border:none;border-top:solid #B5C4DF
            1.0pt;padding:3.0pt 0cm 0cm 0cm">
            <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">
                gdal-dev [<a class="moz-txt-link-freetext" href="mailto:gdal-dev-bounces@lists.osgeo.org">mailto:gdal-dev-bounces@lists.osgeo.org</a>]
                <b>On Behalf Of </b>Ari Jolma<br>
                <b>Sent:</b> 18 November 2015 11:35<br>
                <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
                <b>Subject:</b> Re: [gdal-dev] GCPsToGeoTransform
                returns wrong values<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal" style="margin-bottom:12.0pt">Bar,<br>
          <br>
          I think you are setting the GCPs up wrongly if you want them
          to be at the corners.<br>
          <br>
          GCP(LeftDown.X, LeftDown.Y, LeftDown.Z, Height - 0.5, null,
          "4") does not have 0 before Height-0.5.<br>
          <br>
          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.<br>
          <br>
          I'm not sure if it makes sense to have real values for the
          pixel coordinates although they are real values.<br>
          <br>
          Best,<br>
          <br>
          Ari<o:p></o:p></p>
        <div>
          <p class="MsoNormal">On 18.11.2015 09:32, Bar Ori wrote:<o:p></o:p></p>
        </div>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <p class="MsoNormal">Hi,<o:p></o:p></p>
          <p class="MsoNormal">I noticed something that for me looks
            weird and I would like to know maybe I am doing something
            wrong.<o:p></o:p></p>
          <p class="MsoNormal">If not, how should I overcome this
            behavior.<o:p></o:p></p>
          <p class="MsoNormal"> <o:p></o:p></p>
          <p class="MsoNormal">I set 4 GCPs as follows:<o:p></o:p></p>
          <p class="MsoNormal"> <o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas;color:blue">var</span><span
              style="font-size:9.5pt;font-family:Consolas"> gcps =
            </span><span
              style="font-size:9.5pt;font-family:Consolas;color:blue">new</span><span
              style="font-size:9.5pt;font-family:Consolas">[]</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas">{</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas;color:blue">new</span><span
              style="font-size:9.5pt;font-family:Consolas">
              GCP(LeftUp.X, LeftUp.Y, LeftUp.Z, 0.5, 0.5,
            </span><span
              style="font-size:9.5pt;font-family:Consolas;color:blue">null</span><span
              style="font-size:9.5pt;font-family:Consolas">,
            </span><span
              style="font-size:9.5pt;font-family:Consolas;color:#A31515">"1"</span><span
              style="font-size:9.5pt;font-family:Consolas">),</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas;color:blue">new</span><span
              style="font-size:9.5pt;font-family:Consolas">
              GCP(RightUp.X, RightUp.Y, RightUp.Z, Width - 0.5, 0.5,
            </span><span
              style="font-size:9.5pt;font-family:Consolas;color:blue">null</span><span
              style="font-size:9.5pt;font-family:Consolas">,
            </span><span
              style="font-size:9.5pt;font-family:Consolas;color:#A31515">"2"</span><span
              style="font-size:9.5pt;font-family:Consolas">),</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas;color:blue">new</span><span
              style="font-size:9.5pt;font-family:Consolas">
              GCP(RightDown.X, RightDown.Y, RightDown.Z, Width - 0.5,
              Height - 0.5,
            </span><span
              style="font-size:9.5pt;font-family:Consolas;color:blue">null</span><span
              style="font-size:9.5pt;font-family:Consolas">,
            </span><span
              style="font-size:9.5pt;font-family:Consolas;color:#A31515">"3"</span><span
              style="font-size:9.5pt;font-family:Consolas">),</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas;color:blue">new</span><span
              style="font-size:9.5pt;font-family:Consolas">
              GCP(LeftDown.X, LeftDown.Y, LeftDown.Z, Height - 0.5,
            </span><span
              style="font-size:9.5pt;font-family:Consolas;color:blue">null</span><span
              style="font-size:9.5pt;font-family:Consolas">,
            </span><span
              style="font-size:9.5pt;font-family:Consolas;color:#A31515">"4"</span><span
              style="font-size:9.5pt;font-family:Consolas">)</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas">};</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas"> </span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas">And when I am
              doing as follows:</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas"> </span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas;color:blue">var</span><span
              style="font-size:9.5pt;font-family:Consolas"> geotransform
              =
            </span><span
              style="font-size:9.5pt;font-family:Consolas;color:blue">new</span><span
              style="font-size:9.5pt;font-family:Consolas">
            </span><span
              style="font-size:9.5pt;font-family:Consolas;color:blue">double</span><span
              style="font-size:9.5pt;font-family:Consolas">[6];</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas">Gdal.GCPsToGeoTransform(gcps,
              geotransform, 0)</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas"> </span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas">Or (after
              using dataSet.SetGCPs(gcps, projection) :</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas"> </span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas;color:blue">var</span><span
              style="font-size:9.5pt;font-family:Consolas"> geotransform
              =
            </span><span
              style="font-size:9.5pt;font-family:Consolas;color:blue">new</span><span
              style="font-size:9.5pt;font-family:Consolas">
            </span><span
              style="font-size:9.5pt;font-family:Consolas;color:blue">double</span><span
              style="font-size:9.5pt;font-family:Consolas">[6];</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas">dataSet.GetGeoTransform(geotransform);</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas"> </span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas">So the values
              returned, are wrong.</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas">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.</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas">The same with
              all the geotransform values.</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas">If I am
              getting from the dataset and setting again, every time it
              is changing more and more.</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas">Is there any
              connection to the use of the “0.5”?</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas"> </span><o:p></o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:9.5pt;font-family:Consolas">Thanks.</span><o:p></o:p></p>
          <p class="MsoNormal"> <o:p></o:p></p>
          <p class="MsoNormal" style="text-align:justify"><b><span
                style="color:#1F497D"> </span></b><o:p></o:p></p>
          <table class="MsoNormalTable" style="border-collapse:collapse"
            border="0" cellpadding="0" cellspacing="0">
            <tbody>
              <tr>
                <td style="width:78.0pt;border:none;border-right:solid
                  #1F497D 1.0pt;padding:0cm 5.4pt 0cm 7.1pt" width="104">
                  <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#4D4D4D"><img
                          id="Picture_x0020_2"
                          src="cid:part1.08040509.07080305@gmail.com"
                          height="33" width="98"></span></b><o:p></o:p></p>
                </td>
                <td style="width:338.5pt;padding:0cm 5.4pt 0cm 7.1pt"
                  width="451">
                  <p class="MsoNormal"><b><span
                        style="font-size:10.0pt;font-family:DaxOT-Regular;color:#1F497D">Ori
                        Bar |</span></b><span dir="RTL"></span><span
                      dir="RTL"></span><b><span dir="RTL"
                        style="font-size:10.0pt;font-family:"Times
                        New Roman","serif""><span
                          dir="RTL"></span><span dir="RTL"></span>
                      </span></b><span
                      style="font-size:10.0pt;font-family:DaxOT-Regular;color:gray">Software
                      Developer</span><o:p></o:p></p>
                  <p class="MsoNormal"><span
                      style="font-size:10.0pt;font-family:DaxOT-Regular;color:gray">Applications
                      Development</span><o:p></o:p></p>
                  <p class="MsoNormal"><span
                      style="font-size:10.0pt;font-family:DaxOT-Regular;color:gray">Elbit
                      Systems Land and C4I</span><o:p></o:p></p>
                  <p class="MsoNormal"><b><span
                        style="font-size:10.0pt;font-family:DaxOT-Regular;color:#1F497D">T 
                      </span></b><span
                      style="font-size:10.0pt;font-family:DaxOT-Regular;color:gray">+972-9-8898<b>900 
                      </b></span><b><span
                        style="font-size:10.0pt;font-family:DaxOT-Regular;color:#1F497D">|</span></b><b><span
style="font-size:10.0pt;font-family:DaxOT-Regular;color:gray">  
                      </span></b><b><span
                        style="font-size:10.0pt;font-family:DaxOT-Regular;color:#1F497D">M</span></b><b><span
style="font-size:10.0pt;font-family:DaxOT-Regular;color:gray"> 
                      </span></b><span
                      style="font-size:10.0pt;font-family:DaxOT-Regular;color:gray">+972-504-734296</span><o:p></o:p></p>
                </td>
              </tr>
            </tbody>
          </table>
          <p class="MsoNormal" style="text-align:justify"><b> </b><o:p></o:p></p>
          <p class="MsoNormal"> <o:p></o:p></p>
          <div>
            <p class="MsoNormal"><span
                style="font-size:12.0pt;font-family:"Times New
                Roman","serif""> <o:p></o:p></span></p>
          </div>
          <p class="MsoNormal"><strong><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:navy">The
                information in this e-mail transmission contains
                proprietary and business
              </span></strong><b><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:navy"><br>
                <strong><span
                    style="font-family:"Arial","sans-serif"">sensitive
                    information.  Unauthorized interception of this
                    e-mail may constitute
                  </span></strong><br>
                <strong><span
                    style="font-family:"Arial","sans-serif"">a
                    violation of law. If you are not the intended
                    recipient, you are hereby
                  </span></strong><br>
                <strong><span
                    style="font-family:"Arial","sans-serif"">notified
                    that any review, dissemination, distribution or
                    duplication of this
                  </span></strong><br>
                <strong><span
                    style="font-family:"Arial","sans-serif"">communication
                    is strictly prohibited. You are also asked to
                    contact the sender
                  </span></strong><br>
                <strong><span
                    style="font-family:"Arial","sans-serif"">by
                    reply email and immediately destroy all copies of
                    the original message.</span></strong></span></b><span
              style="font-size:12.0pt;font-family:"Times New
              Roman","serif""><o:p></o:p></span></p>
          <p class="MsoNormal"><span
              style="font-size:12.0pt;font-family:"Times New
              Roman","serif""><br>
              <br>
              <br>
              <o:p></o:p></span></p>
          <pre>_______________________________________________<o:p></o:p></pre>
          <pre>gdal-dev mailing list<o:p></o:p></pre>
          <pre><a moz-do-not-send="true" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><o:p></o:p></pre>
          <pre><a moz-do-not-send="true" href="http://lists.osgeo.org/mailman/listinfo/gdal-dev">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><o:p></o:p></pre>
        </blockquote>
        <p class="MsoNormal"><span
            style="font-size:12.0pt;font-family:"Times New
            Roman","serif""><o:p> </o:p></span></p>
      </div>
      <div><strong></strong> </div>
      <div align="left"><strong><font face="Arial" size="2"
            color="#000080">The information in this e-mail transmission
            contains proprietary and business <br>
            sensitive information.  Unauthorized interception of this
            e-mail may constitute <br>
            a violation of law. If you are not the intended recipient,
            you are hereby <br>
            notified that any review, dissemination, distribution or
            duplication of this <br>
            communication is strictly prohibited. You are also asked to
            contact the sender <br>
            by reply email and immediately destroy all copies of the
            original message.<br>
          </font></strong></div>
    </blockquote>
    <br>
  </body>
</html>