<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi,</p>
    <p>I've ticketed your issue as
      <a class="moz-txt-link-freetext" href="https://github.com/OSGeo/gdal/issues/8672">https://github.com/OSGeo/gdal/issues/8672</a> . What you could try to
      reduce the execution time is to enable multithreading by adding
      -wo NUM_THREADS=ALL_CPUS to your gdalwarp command line</p>
    <p>And yes the previous implementation of the raster TPS
      transformation was "wrong", at least not consistent with the
      forward direction of the TPS transformer as used by ogr2ogr. Both
      matched on the exact location of ground control points, but the
      result could be substantially different in-between. The new
      implementation solves that, but it implies substantial more
      computation cost as you found out...</p>
    <p>Even<br>
    </p>
    <div class="moz-cite-prefix">Le 07/11/2023 à 08:29, Stijn Tallir via
      gdal-dev a écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CAKadDxviz8=dWKtdY=NG+Yvb_7_RXXsy99u93t4WBWfSUqZW8w@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hi Jukka,
        <div><br>
        </div>
        <div>The transformation lasted 3h20min vs 9min (before the
          fix)! </div>
        <div><br>
        </div>
        <div>The results for raster and vector tps transformation are
          very similar now and nothing changed for the vector result. Do
          I have to conclude the previous rasters tps
          transformation method was faulty then?</div>
        <div><br>
        </div>
        <div>Stijn</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">Op ma 6 nov 2023 om 16:32
          schreef Stijn Tallir <<a
            href="mailto:stijn%2Bgdal-dev@strict.be"
            moz-do-not-send="true">stijn+gdal-dev@strict.be</a>>:<br>
        </div>
        <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div dir="ltr">Hi,
            <div><br>
            </div>
            <div>Does that mean the old raster tps transformation was
              "wrong" or the old vector transformation?</div>
            <div><br>
            </div>
            <div>I'm doing a test and trying to transform my raster
              image with the latest dev version in osgeo4W but it takes
              forever to process now. Don't know in how many days I will
              see the result :(</div>
            <div><br>
            </div>
            <div>The vector transformation with the latest dev version
              was the same (time and result).</div>
            <div><br>
            </div>
            <div>Stijn</div>
          </div>
          <br>
          <div class="gmail_quote">
            <div dir="ltr" class="gmail_attr">Op ma 6 nov 2023 om 14:48
              schreef Rahkonen Jukka <<a
                href="mailto:jukka.rahkonen@maanmittauslaitos.fi"
                target="_blank" moz-do-not-send="true"
                class="moz-txt-link-freetext">jukka.rahkonen@maanmittauslaitos.fi</a>>:<br>
            </div>
            <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
              <div>
                <div lang="FI">
                  <div>
                    <p class="MsoNormal"><span lang="EN-US">Hi,</span></p>
                    <p class="MsoNormal"><span lang="EN-US"> </span></p>
                    <p class="MsoNormal"><span lang="EN-US">See the
                        issue
                      </span><span><a
href="https://github.com/OSGeo/gdal/issues/8572" target="_blank"
                          moz-do-not-send="true"><span lang="EN-US">https://github.com/OSGeo/gdal/issues/8572</span></a></span><span
                        lang="EN-US">. Maybe your problem is also
                        resolved by <a
                          href="https://github.com/OSGeo/gdal/pull/8573"
                          target="_blank" moz-do-not-send="true"
                          class="moz-txt-link-freetext">https://github.com/OSGeo/gdal/pull/8573</a>.
                        The fix is included in the GDAL 3.8 RC1 version
                        that was released 3 hour ago. Do you have an
                        option to make a test?</span></p>
                    <p class="MsoNormal"><span lang="EN-US"> </span></p>
                    <p class="MsoNormal"><span lang="EN-US">-Jukka
                        Rahkonen-</span></p>
                    <p class="MsoNormal"><span lang="EN-US"> </span></p>
                    <div
style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0cm 0cm">
                      <p class="MsoNormal"><b>Lähettäjä:</b> Stijn
                        Tallir <<a href="mailto:stijn@strict.be"
                          target="_blank" moz-do-not-send="true"
                          class="moz-txt-link-freetext">stijn@strict.be</a>>
                        <br>
                        <b>Lähetetty:</b> maanantai 6. marraskuuta 2023
                        14.47<br>
                        <b>Vastaanottaja:</b> Rahkonen Jukka <<a
href="mailto:jukka.rahkonen@maanmittauslaitos.fi" target="_blank"
                          moz-do-not-send="true"
                          class="moz-txt-link-freetext">jukka.rahkonen@maanmittauslaitos.fi</a>><br>
                        <b>Kopio:</b> <a
                          href="mailto:gdal-dev@lists.osgeo.org"
                          target="_blank" moz-do-not-send="true"
                          class="moz-txt-link-freetext">gdal-dev@lists.osgeo.org</a><br>
                        <b>Aihe:</b> Re: [gdal-dev] tps - gdalwarp vs
                        ogr2ogr</p>
                    </div>
                    <p class="MsoNormal"> </p>
                    <div>
                      <p class="MsoNormal">Hi Jukka,</p>
                      <div>
                        <p class="MsoNormal"> </p>
                      </div>
                      <div>
                        <p class="MsoNormal">I finally found the time to
                          produce a test set.</p>
                      </div>
                      <div>
                        <p class="MsoNormal"> </p>
                      </div>
                      <div>
                        <p class="MsoNormal">You can download it here: <a
href="https://drive.google.com/file/d/1Y08Q-tIm5dxyKFKNdVqilvAO3H7FFFbx/view?usp=sharing"
                            target="_blank" moz-do-not-send="true"
                            class="moz-txt-link-freetext">https://drive.google.com/file/d/1Y08Q-tIm5dxyKFKNdVqilvAO3H7FFFbx/view?usp=sharing</a></p>
                      </div>
                      <div>
                        <p class="MsoNormal"> </p>
                      </div>
                      <div>
                        <p class="MsoNormal">I started from an
                          unreferenced raster file (raster2tps.tif) with
                          gcp's (gcp4tps.gcp) and transformed it with
                          tps (tpsraster.tif).</p>
                      </div>
                      <div>
                        <p class="MsoNormal">Then polygonized the
                          unreferenced raster file (vector2tps.shp) and
                          transformed the result with  the same gcp's
                          (gcp4tps.gcp) and with tps (tpsvector.shp).</p>
                      </div>
                      <div>
                        <p class="MsoNormal"> </p>
                      </div>
                      <div>
                        <p class="MsoNormal">The vector2tps.shp polygons
                          are "flipped" because of the different
                          Y-origin for rasters and vectors but this way
                          both datasets can use the exact same gcp's. </p>
                      </div>
                      <div>
                        <p class="MsoNormal"> </p>
                      </div>
                      <div>
                        <p class="MsoNormal">When you lay the
                          tpsvector-result on top of the
                          tpsraster-result (in QGis for instance) you'll
                          see the differences in how both are
                          transformed.</p>
                      </div>
                      <div>
                        <p class="MsoNormal"> </p>
                      </div>
                      <div>
                        <p class="MsoNormal">Kind regards,</p>
                      </div>
                      <div>
                        <p class="MsoNormal"> </p>
                      </div>
                      <div>
                        <p class="MsoNormal">Stijn</p>
                      </div>
                      <div>
                        <p class="MsoNormal"> </p>
                      </div>
                      <div>
                        <p class="MsoNormal"> </p>
                      </div>
                    </div>
                    <p class="MsoNormal"> </p>
                    <div>
                      <div>
                        <p class="MsoNormal">Op wo 16 aug 2023 om 13:16
                          schreef Stijn Tallir <<a
                            href="mailto:stijn%2Bgdal-dev@strict.be"
                            target="_blank" moz-do-not-send="true">stijn+gdal-dev@strict.be</a>>:</p>
                      </div>
                      <blockquote
style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
                        <div>
                          <p class="MsoNormal">Yes, I checked them
                            visually for both raster and vector.</p>
                          <div>
                            <p class="MsoNormal"> </p>
                          </div>
                          <div>
                            <p class="MsoNormal">I compared the results
                              also visually. The rasters are transformed
                              in a way that the end ponts of the gcp's
                              align exactly with the result so that is
                              why I referred to it as "right". The
                              vector data result is in the neighbourhood
                              of the end points (sometimes a rather
                              significant distance).</p>
                          </div>
                          <div>
                            <p class="MsoNormal"> </p>
                          </div>
                          <div>
                            <p class="MsoNormal">The result is different
                              from order 1-3 transformations so I
                              presume the tps option isn't ignored.</p>
                          </div>
                          <div>
                            <p class="MsoNormal"> </p>
                          </div>
                          <div>
                            <p class="MsoNormal">Stijn</p>
                          </div>
                        </div>
                        <p class="MsoNormal"> </p>
                        <div>
                          <div>
                            <p class="MsoNormal">Op wo 16 aug 2023 om
                              11:52 schreef Rahkonen Jukka <<a
href="mailto:jukka.rahkonen@maanmittauslaitos.fi" target="_blank"
                                moz-do-not-send="true"
                                class="moz-txt-link-freetext">jukka.rahkonen@maanmittauslaitos.fi</a>>:</p>
                          </div>
                          <blockquote
style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
                            <div>
                              <div>
                                <div>
                                  <p class="MsoNormal">Hi,</p>
                                  <p class="MsoNormal"> </p>
                                  <p class="MsoNormal"><span
                                      lang="EN-US">Did you check the
                                      ground control points? What is
                                      your reference when you say that
                                      one result is right, and another
                                      wrong? Have you used some other
                                      software for comparison? Or do you
                                      only know that the results are
                                      different?</span></p>
                                  <p class="MsoNormal"><span
                                      lang="EN-US"> </span></p>
                                  <p class="MsoNormal"><span
                                      lang="EN-US">-Jukka-</span></p>
                                  <p class="MsoNormal"><span
                                      lang="EN-US"> </span></p>
                                  <div
style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0cm 0cm">
                                    <p class="MsoNormal"><b>Lähettäjä:</b>
                                      Stijn Tallir <<a
                                        href="mailto:stijn@strict.be"
                                        target="_blank"
                                        moz-do-not-send="true"
                                        class="moz-txt-link-freetext">stijn@strict.be</a>>
                                      <br>
                                      <b>Lähetetty:</b> keskiviikko 16.
                                      elokuuta 2023 12.27<br>
                                      <b>Vastaanottaja:</b> Rahkonen
                                      Jukka <<a
href="mailto:jukka.rahkonen@maanmittauslaitos.fi" target="_blank"
                                        moz-do-not-send="true"
                                        class="moz-txt-link-freetext">jukka.rahkonen@maanmittauslaitos.fi</a>><br>
                                      <b>Kopio:</b> <a
href="mailto:gdal-dev@lists.osgeo.org" target="_blank"
                                        moz-do-not-send="true"
                                        class="moz-txt-link-freetext">gdal-dev@lists.osgeo.org</a><br>
                                      <b>Aihe:</b> Re: [gdal-dev] tps -
                                      gdalwarp vs ogr2ogr</p>
                                  </div>
                                  <p class="MsoNormal"> </p>
                                  <div>
                                    <p class="MsoNormal">Hi Jukka,</p>
                                    <div>
                                      <p class="MsoNormal"> </p>
                                    </div>
                                    <div>
                                      <p class="MsoNormal">I thought of
                                        the density as an option for the
                                        "error" as you suggested and I
                                        made a point-file with a point
                                        for every pixel in my original
                                        image and used this as a source
                                        for the ogr2ogr transformation.
                                        So you could say the desnity for
                                        both sources raster and vector)
                                        are then alike.</p>
                                    </div>
                                    <div>
                                      <p class="MsoNormal"> </p>
                                    </div>
                                    <div>
                                      <p class="MsoNormal">The results
                                        were still the same (and wrong)
                                        ... </p>
                                    </div>
                                    <div>
                                      <p class="MsoNormal"> </p>
                                    </div>
                                    <div>
                                      <p class="MsoNormal">Stijn</p>
                                    </div>
                                    <div>
                                      <p class="MsoNormal"> </p>
                                    </div>
                                  </div>
                                  <p class="MsoNormal"> </p>
                                  <div>
                                    <div>
                                      <p class="MsoNormal">Op wo 16 aug
                                        2023 om 10:22 schreef Rahkonen
                                        Jukka <<a
href="mailto:jukka.rahkonen@maanmittauslaitos.fi" target="_blank"
                                          moz-do-not-send="true"
                                          class="moz-txt-link-freetext">jukka.rahkonen@maanmittauslaitos.fi</a>>:</p>
                                    </div>
                                    <blockquote
style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt">
                                      <div>
                                        <div>
                                          <div>
                                            <p class="MsoNormal">Hi,</p>
                                            <p class="MsoNormal"> </p>
                                            <p class="MsoNormal"><span
                                                lang="EN-US">Without
                                                test data it is very
                                                hard to say much. I
                                                believe that the promise
                                                of tps is that the
                                                ground control points
                                                stay where they are set.
                                                The intermediate points
                                                follow the least tension
                                                surfaces and I do not
                                                know how exactly those
                                                spline algorithms are
                                                defined. Raster data is
                                                full of points to warp
                                                but probably in the
                                                vector data the
                                                transformation is done
                                                vertex by vertex. I
                                                would first check if the
                                                GCPs are in the same
                                                place in both outputs.
                                                Then I would make a test
                                                by densifying the vector
                                                data before
                                                georeferencing to have
                                                much more vertices and
                                                see if it has any effect
                                                on the result.</span></p>
                                            <p class="MsoNormal"><span
                                                lang="EN-US"> </span></p>
                                            <p class="MsoNormal"><span
                                                lang="EN-US">-Jukka
                                                Rahkonen-</span></p>
                                            <p class="MsoNormal"><span
                                                lang="EN-US"> </span></p>
                                            <div
style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0cm 0cm">
                                              <p class="MsoNormal"><b>Lähettäjä:</b>
                                                gdal-dev <<a
href="mailto:gdal-dev-bounces@lists.osgeo.org" target="_blank"
                                                  moz-do-not-send="true"
class="moz-txt-link-freetext">gdal-dev-bounces@lists.osgeo.org</a>>
                                                <b>Puolesta </b>Stijn
                                                Tallir<br>
                                                <b>Lähetetty:</b>
                                                keskiviikko 16. elokuuta
                                                2023 10.29<br>
                                                <b>Vastaanottaja:</b> <a
href="mailto:gdal-dev@lists.osgeo.org" target="_blank"
                                                  moz-do-not-send="true"
class="moz-txt-link-freetext">gdal-dev@lists.osgeo.org</a><br>
                                                <b>Aihe:</b> [gdal-dev]
                                                tps - gdalwarp vs
                                                ogr2ogr</p>
                                            </div>
                                            <p class="MsoNormal"> </p>
                                            <div>
                                              <p class="MsoNormal">Hi,</p>
                                              <div>
                                                <p class="MsoNormal"> </p>
                                              </div>
                                              <div>
                                                <p class="MsoNormal">According to
                                                  the documentation gdal
                                                  and ogr use the same
                                                  algorithm for the
                                                  tps-transformation but
                                                  I don't seem to get
                                                  the same results using
                                                  the same set of gcp's
                                                  for images and
                                                  vectors.</p>
                                              </div>
                                              <div>
                                                <p class="MsoNormal"> </p>
                                              </div>
                                              <div>
                                                <p class="MsoNormal">I
                                                  have images that are
                                                  unreferenced and
                                                  vector data digitised
                                                  on these images (in
                                                  pixel coordinates).</p>
                                              </div>
                                              <div>
                                                <p class="MsoNormal"> </p>
                                              </div>
                                              <div>
                                                <p class="MsoNormal">The
                                                  images are then
                                                  georeferenced with
                                                  +100 gcp's and warped
                                                  with gdalwarp using
                                                  the "tps" option.</p>
                                              </div>
                                              <div>
                                                <p class="MsoNormal"> </p>
                                              </div>
                                              <div>
                                                <p class="MsoNormal">When
                                                  I use the same gcp's
                                                  (with adjusted
                                                  y-origin to lower left
                                                  corner) to
                                                  georeference
                                                  the vector data with
                                                  ogr2ogr and the "tps"
                                                  option I get different
                                                  results. The
                                                  vector-result is
                                                  similar to the
                                                  image-result but never
                                                  exactly the same and
                                                  differences can be
                                                  substantial.</p>
                                              </div>
                                              <div>
                                                <p class="MsoNormal"> </p>
                                              </div>
                                              <div>
                                                <p class="MsoNormal">Any
                                                  thoughts?</p>
                                              </div>
                                              <div>
                                                <p class="MsoNormal"> </p>
                                              </div>
                                              <div>
                                                <p class="MsoNormal">Stijn</p>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </blockquote>
                                  </div>
                                  <p class="MsoNormal"><br clear="all">
                                  </p>
                                  <div>
                                    <p class="MsoNormal"> </p>
                                  </div>
                                  <p class="MsoNormal">--
                                  </p>
                                  <div>
                                    <div>
                                      <div>
                                        <div>
                                          <div>
                                            <p class="MsoNormal">Stijn
                                              Tallir - StrICT BV</p>
                                          </div>
                                          <div>
                                            <p class="MsoNormal"> </p>
                                          </div>
                                          <div>
                                            <p class="MsoNormal">Wijnveld
                                              8</p>
                                          </div>
                                          <div>
                                            <p class="MsoNormal">9112
                                              Sinaai-Waas</p>
                                          </div>
                                          <div>
                                            <p class="MsoNormal"> </p>
                                          </div>
                                          <div>
                                            <p class="MsoNormal">GSM:
                                              0486 750220</p>
                                          </div>
                                          <div>
                                            <p class="MsoNormal"> </p>
                                          </div>
                                          <div>
                                            <p class="MsoNormal">E-mail:
                                              <a
href="mailto:Info@strict.be" target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">Info@strict.be</a></p>
                                          </div>
                                          <div>
                                            <p class="MsoNormal">Web:
                                              <a
href="http://www.strict.be/" target="_blank" moz-do-not-send="true">www.strict.be</a></p>
                                          </div>
                                          <div>
                                            <p class="MsoNormal"> </p>
                                          </div>
                                          <div>
                                            <p class="MsoNormal">BTW: BE
                                              0567.559.668</p>
                                          </div>
                                          <div>
                                            <p class="MsoNormal"> </p>
                                          </div>
                                          <div>
                                            <p class="MsoNormal"><img
style="width: 3.0104in; height: 1.6875in;"
id="m_-1996727438422850794m_-4494117267073493215_x0000_i1026"
src="http://www.strict.be/strict_web2.jpg" moz-do-not-send="true"
                                                width="289" height="162"
                                                border="0"></p>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </blockquote>
                        </div>
                      </blockquote>
                    </div>
                    <p class="MsoNormal"><br clear="all">
                    </p>
                    <div>
                      <p class="MsoNormal"> </p>
                    </div>
                    <p class="MsoNormal"><span>-- </span></p>
                    <div>
                      <div>
                        <div>
                          <div>
                            <div>
                              <p class="MsoNormal">Stijn Tallir - StrICT
                                BV</p>
                            </div>
                            <div>
                              <p class="MsoNormal"> </p>
                            </div>
                            <div>
                              <p class="MsoNormal">Wijnveld 8</p>
                            </div>
                            <div>
                              <p class="MsoNormal">9112 Sinaai-Waas</p>
                            </div>
                            <div>
                              <p class="MsoNormal"> </p>
                            </div>
                            <div>
                              <p class="MsoNormal">GSM: 0486 750220</p>
                            </div>
                            <div>
                              <p class="MsoNormal"> </p>
                            </div>
                            <div>
                              <p class="MsoNormal">E-mail: <a
                                  href="mailto:Info@strict.be"
                                  target="_blank" moz-do-not-send="true"
                                  class="moz-txt-link-freetext">Info@strict.be</a></p>
                            </div>
                            <div>
                              <p class="MsoNormal">Web: <a
                                  href="http://www.strict.be/"
                                  target="_blank" moz-do-not-send="true">www.strict.be</a></p>
                            </div>
                            <div>
                              <p class="MsoNormal"> </p>
                            </div>
                            <div>
                              <p class="MsoNormal">BTW: BE 0567.559.668</p>
                            </div>
                            <div>
                              <p class="MsoNormal"> </p>
                            </div>
                            <div>
                              <p class="MsoNormal"><img
style="width: 3.0104in; height: 1.6875in;"
id="m_-1996727438422850794m_-4494117267073493215_x0000_i1025"
src="http://www.strict.be/strict_web2.jpg" moz-do-not-send="true"
                                  width="289" height="162" border="0"></p>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </blockquote>
          </div>
        </blockquote>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>