Why does osr.SpatialReference return different values in python2 and 3?











up vote
4
down vote

favorite












Can somebody explain why the result of osr.SpatialReference() differ between Python 2 and 3?



sr = osr.SpatialReference()
sr.SetFromUserInput('EPSG:28992')
sr.ExportToProj4()


In Python 2.7 this gives me



Out[15]: '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=565.417,50.3319,465.552,-0.398957,0.343988,-1.8774,4.0725 +units=m +no_defs '


In Python 3 though, I get a different answer:



Out[14]: '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=565.2369,50.0087,465.658,-0.406857,0.350733,-1.87035,4.0812 +units=m +no_defs'









share|improve this question




























    up vote
    4
    down vote

    favorite












    Can somebody explain why the result of osr.SpatialReference() differ between Python 2 and 3?



    sr = osr.SpatialReference()
    sr.SetFromUserInput('EPSG:28992')
    sr.ExportToProj4()


    In Python 2.7 this gives me



    Out[15]: '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=565.417,50.3319,465.552,-0.398957,0.343988,-1.8774,4.0725 +units=m +no_defs '


    In Python 3 though, I get a different answer:



    Out[14]: '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=565.2369,50.0087,465.658,-0.406857,0.350733,-1.87035,4.0812 +units=m +no_defs'









    share|improve this question


























      up vote
      4
      down vote

      favorite









      up vote
      4
      down vote

      favorite











      Can somebody explain why the result of osr.SpatialReference() differ between Python 2 and 3?



      sr = osr.SpatialReference()
      sr.SetFromUserInput('EPSG:28992')
      sr.ExportToProj4()


      In Python 2.7 this gives me



      Out[15]: '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=565.417,50.3319,465.552,-0.398957,0.343988,-1.8774,4.0725 +units=m +no_defs '


      In Python 3 though, I get a different answer:



      Out[14]: '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=565.2369,50.0087,465.658,-0.406857,0.350733,-1.87035,4.0812 +units=m +no_defs'









      share|improve this question















      Can somebody explain why the result of osr.SpatialReference() differ between Python 2 and 3?



      sr = osr.SpatialReference()
      sr.SetFromUserInput('EPSG:28992')
      sr.ExportToProj4()


      In Python 2.7 this gives me



      Out[15]: '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=565.417,50.3319,465.552,-0.398957,0.343988,-1.8774,4.0725 +units=m +no_defs '


      In Python 3 though, I get a different answer:



      Out[14]: '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=565.2369,50.0087,465.658,-0.406857,0.350733,-1.87035,4.0812 +units=m +no_defs'






      coordinate-system gdal python-2.7 python-3






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 16 at 13:01









      Vince

      14.2k32646




      14.2k32646










      asked Nov 16 at 8:05









      LarsVegas

      1,38211635




      1,38211635






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          7
          down vote



          accepted










          The projections differ in the datum shift values for the conversion from Amersfoort datum to WGS84.



          The first one is tfm code 4833, and the second is tfm code 15934.



          GDAL 2.1.0 uses tfm code 4833, while GDAL 2.2.0 and later uses tfm code 15934. The change was done in https://trac.osgeo.org/gdal/changeset/37081



          According to the remarks, 4833 is the latest definition. See also https://trac.osgeo.org/gdal/ticket/2487 for the difference.



          If you want higher precision, you could use a grid shift file for the transformation, see http://osgeo-org.1560.x6.nabble.com/Amersfoort-RD-New-td5293753.html






          share|improve this answer























          • so his system uses different gdal versions?
            – nickves
            Nov 16 at 11:12










          • Unless they compiled the Python bindings themselves, that seems likely.
            – bugmenot123
            Nov 16 at 12:29










          • Excellent answer.
            – LarsVegas
            Nov 16 at 18:32






          • 1




            @bugmenot123 it is not necessary to compile the Python bindings yourself, you can just exchange the csv files to get the transformation synchronous in both pythons.
            – AndreJ
            yesterday











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "79"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f302884%2fwhy-does-osr-spatialreference-return-different-values-in-python2-and-3%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          7
          down vote



          accepted










          The projections differ in the datum shift values for the conversion from Amersfoort datum to WGS84.



          The first one is tfm code 4833, and the second is tfm code 15934.



          GDAL 2.1.0 uses tfm code 4833, while GDAL 2.2.0 and later uses tfm code 15934. The change was done in https://trac.osgeo.org/gdal/changeset/37081



          According to the remarks, 4833 is the latest definition. See also https://trac.osgeo.org/gdal/ticket/2487 for the difference.



          If you want higher precision, you could use a grid shift file for the transformation, see http://osgeo-org.1560.x6.nabble.com/Amersfoort-RD-New-td5293753.html






          share|improve this answer























          • so his system uses different gdal versions?
            – nickves
            Nov 16 at 11:12










          • Unless they compiled the Python bindings themselves, that seems likely.
            – bugmenot123
            Nov 16 at 12:29










          • Excellent answer.
            – LarsVegas
            Nov 16 at 18:32






          • 1




            @bugmenot123 it is not necessary to compile the Python bindings yourself, you can just exchange the csv files to get the transformation synchronous in both pythons.
            – AndreJ
            yesterday















          up vote
          7
          down vote



          accepted










          The projections differ in the datum shift values for the conversion from Amersfoort datum to WGS84.



          The first one is tfm code 4833, and the second is tfm code 15934.



          GDAL 2.1.0 uses tfm code 4833, while GDAL 2.2.0 and later uses tfm code 15934. The change was done in https://trac.osgeo.org/gdal/changeset/37081



          According to the remarks, 4833 is the latest definition. See also https://trac.osgeo.org/gdal/ticket/2487 for the difference.



          If you want higher precision, you could use a grid shift file for the transformation, see http://osgeo-org.1560.x6.nabble.com/Amersfoort-RD-New-td5293753.html






          share|improve this answer























          • so his system uses different gdal versions?
            – nickves
            Nov 16 at 11:12










          • Unless they compiled the Python bindings themselves, that seems likely.
            – bugmenot123
            Nov 16 at 12:29










          • Excellent answer.
            – LarsVegas
            Nov 16 at 18:32






          • 1




            @bugmenot123 it is not necessary to compile the Python bindings yourself, you can just exchange the csv files to get the transformation synchronous in both pythons.
            – AndreJ
            yesterday













          up vote
          7
          down vote



          accepted







          up vote
          7
          down vote



          accepted






          The projections differ in the datum shift values for the conversion from Amersfoort datum to WGS84.



          The first one is tfm code 4833, and the second is tfm code 15934.



          GDAL 2.1.0 uses tfm code 4833, while GDAL 2.2.0 and later uses tfm code 15934. The change was done in https://trac.osgeo.org/gdal/changeset/37081



          According to the remarks, 4833 is the latest definition. See also https://trac.osgeo.org/gdal/ticket/2487 for the difference.



          If you want higher precision, you could use a grid shift file for the transformation, see http://osgeo-org.1560.x6.nabble.com/Amersfoort-RD-New-td5293753.html






          share|improve this answer














          The projections differ in the datum shift values for the conversion from Amersfoort datum to WGS84.



          The first one is tfm code 4833, and the second is tfm code 15934.



          GDAL 2.1.0 uses tfm code 4833, while GDAL 2.2.0 and later uses tfm code 15934. The change was done in https://trac.osgeo.org/gdal/changeset/37081



          According to the remarks, 4833 is the latest definition. See also https://trac.osgeo.org/gdal/ticket/2487 for the difference.



          If you want higher precision, you could use a grid shift file for the transformation, see http://osgeo-org.1560.x6.nabble.com/Amersfoort-RD-New-td5293753.html







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 16 at 20:50









          mkennedy

          15.4k13156




          15.4k13156










          answered Nov 16 at 9:08









          AndreJ

          67.2k559119




          67.2k559119












          • so his system uses different gdal versions?
            – nickves
            Nov 16 at 11:12










          • Unless they compiled the Python bindings themselves, that seems likely.
            – bugmenot123
            Nov 16 at 12:29










          • Excellent answer.
            – LarsVegas
            Nov 16 at 18:32






          • 1




            @bugmenot123 it is not necessary to compile the Python bindings yourself, you can just exchange the csv files to get the transformation synchronous in both pythons.
            – AndreJ
            yesterday


















          • so his system uses different gdal versions?
            – nickves
            Nov 16 at 11:12










          • Unless they compiled the Python bindings themselves, that seems likely.
            – bugmenot123
            Nov 16 at 12:29










          • Excellent answer.
            – LarsVegas
            Nov 16 at 18:32






          • 1




            @bugmenot123 it is not necessary to compile the Python bindings yourself, you can just exchange the csv files to get the transformation synchronous in both pythons.
            – AndreJ
            yesterday
















          so his system uses different gdal versions?
          – nickves
          Nov 16 at 11:12




          so his system uses different gdal versions?
          – nickves
          Nov 16 at 11:12












          Unless they compiled the Python bindings themselves, that seems likely.
          – bugmenot123
          Nov 16 at 12:29




          Unless they compiled the Python bindings themselves, that seems likely.
          – bugmenot123
          Nov 16 at 12:29












          Excellent answer.
          – LarsVegas
          Nov 16 at 18:32




          Excellent answer.
          – LarsVegas
          Nov 16 at 18:32




          1




          1




          @bugmenot123 it is not necessary to compile the Python bindings yourself, you can just exchange the csv files to get the transformation synchronous in both pythons.
          – AndreJ
          yesterday




          @bugmenot123 it is not necessary to compile the Python bindings yourself, you can just exchange the csv files to get the transformation synchronous in both pythons.
          – AndreJ
          yesterday


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f302884%2fwhy-does-osr-spatialreference-return-different-values-in-python2-and-3%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          QoS: MAC-Priority for clients behind a repeater

          Ивакино (Тотемский район)

          Can't locate Autom4te/ChannelDefs.pm in @INC (when it definitely is there)