How to get real north and magnetic north with getOrientation function












2















How to get real north and magnetic north with getOrientation function?



getOrientation function returns float[3] with bearing, pitch and roll in second parameter...
How I can calculate real north from these values?



Thank you










share|improve this question



























    2















    How to get real north and magnetic north with getOrientation function?



    getOrientation function returns float[3] with bearing, pitch and roll in second parameter...
    How I can calculate real north from these values?



    Thank you










    share|improve this question

























      2












      2








      2


      1






      How to get real north and magnetic north with getOrientation function?



      getOrientation function returns float[3] with bearing, pitch and roll in second parameter...
      How I can calculate real north from these values?



      Thank you










      share|improve this question














      How to get real north and magnetic north with getOrientation function?



      getOrientation function returns float[3] with bearing, pitch and roll in second parameter...
      How I can calculate real north from these values?



      Thank you







      android orientation






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 12 '10 at 19:40









      LILkillaBEELILkillaBEE

      1121516




      1121516
























          2 Answers
          2






          active

          oldest

          votes


















          2














          The first float in your array is what you want to use to figure magnetic north.



          For "true" north, you need to use GeomagneticField.getDeclination(). You have to initialize that class with the approximate location (network-provided is sufficient).






          share|improve this answer
























          • Isn't that the 'old way' to get north?

            – LILkillaBEE
            Jun 24 '11 at 15:57











          • Old? Are you referring to the Orientation sensor? The GeomagneticField class is not deprecated, and it doesn't on its own interact with the sensors, but it does provide data based on models of the shape of the magnetic field for a given lat,lon.

            – Pierre-Luc Paour
            Jun 27 '11 at 7:24



















          2














          I am not sure this is the right answer, but my guess is that you will only be able to get the magnetic north because that's what the compass will give you.



          To "calculate" the true north, you will need your (or the phone's) location and then map that to find the right deviation. You could use some online tool or maybe based on maps you can try to have some simple formula to compute it... (can work if you target it to a specific area).



          Couple of notes also...




          • It will not be too precise anyway, you will always have errors introduced by the variation which is caused by the environment of the compass.

          • The difference between true and magnetic north changes constantly... not very fast, but over a couple of years, you'll definitely have a difference (depends how accurate you want to be)






          share|improve this answer

























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            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',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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%2fstackoverflow.com%2fquestions%2f4423597%2fhow-to-get-real-north-and-magnetic-north-with-getorientation-function%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            The first float in your array is what you want to use to figure magnetic north.



            For "true" north, you need to use GeomagneticField.getDeclination(). You have to initialize that class with the approximate location (network-provided is sufficient).






            share|improve this answer
























            • Isn't that the 'old way' to get north?

              – LILkillaBEE
              Jun 24 '11 at 15:57











            • Old? Are you referring to the Orientation sensor? The GeomagneticField class is not deprecated, and it doesn't on its own interact with the sensors, but it does provide data based on models of the shape of the magnetic field for a given lat,lon.

              – Pierre-Luc Paour
              Jun 27 '11 at 7:24
















            2














            The first float in your array is what you want to use to figure magnetic north.



            For "true" north, you need to use GeomagneticField.getDeclination(). You have to initialize that class with the approximate location (network-provided is sufficient).






            share|improve this answer
























            • Isn't that the 'old way' to get north?

              – LILkillaBEE
              Jun 24 '11 at 15:57











            • Old? Are you referring to the Orientation sensor? The GeomagneticField class is not deprecated, and it doesn't on its own interact with the sensors, but it does provide data based on models of the shape of the magnetic field for a given lat,lon.

              – Pierre-Luc Paour
              Jun 27 '11 at 7:24














            2












            2








            2







            The first float in your array is what you want to use to figure magnetic north.



            For "true" north, you need to use GeomagneticField.getDeclination(). You have to initialize that class with the approximate location (network-provided is sufficient).






            share|improve this answer













            The first float in your array is what you want to use to figure magnetic north.



            For "true" north, you need to use GeomagneticField.getDeclination(). You have to initialize that class with the approximate location (network-provided is sufficient).







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jun 23 '11 at 14:41









            Pierre-Luc PaourPierre-Luc Paour

            1,3841318




            1,3841318













            • Isn't that the 'old way' to get north?

              – LILkillaBEE
              Jun 24 '11 at 15:57











            • Old? Are you referring to the Orientation sensor? The GeomagneticField class is not deprecated, and it doesn't on its own interact with the sensors, but it does provide data based on models of the shape of the magnetic field for a given lat,lon.

              – Pierre-Luc Paour
              Jun 27 '11 at 7:24



















            • Isn't that the 'old way' to get north?

              – LILkillaBEE
              Jun 24 '11 at 15:57











            • Old? Are you referring to the Orientation sensor? The GeomagneticField class is not deprecated, and it doesn't on its own interact with the sensors, but it does provide data based on models of the shape of the magnetic field for a given lat,lon.

              – Pierre-Luc Paour
              Jun 27 '11 at 7:24

















            Isn't that the 'old way' to get north?

            – LILkillaBEE
            Jun 24 '11 at 15:57





            Isn't that the 'old way' to get north?

            – LILkillaBEE
            Jun 24 '11 at 15:57













            Old? Are you referring to the Orientation sensor? The GeomagneticField class is not deprecated, and it doesn't on its own interact with the sensors, but it does provide data based on models of the shape of the magnetic field for a given lat,lon.

            – Pierre-Luc Paour
            Jun 27 '11 at 7:24





            Old? Are you referring to the Orientation sensor? The GeomagneticField class is not deprecated, and it doesn't on its own interact with the sensors, but it does provide data based on models of the shape of the magnetic field for a given lat,lon.

            – Pierre-Luc Paour
            Jun 27 '11 at 7:24













            2














            I am not sure this is the right answer, but my guess is that you will only be able to get the magnetic north because that's what the compass will give you.



            To "calculate" the true north, you will need your (or the phone's) location and then map that to find the right deviation. You could use some online tool or maybe based on maps you can try to have some simple formula to compute it... (can work if you target it to a specific area).



            Couple of notes also...




            • It will not be too precise anyway, you will always have errors introduced by the variation which is caused by the environment of the compass.

            • The difference between true and magnetic north changes constantly... not very fast, but over a couple of years, you'll definitely have a difference (depends how accurate you want to be)






            share|improve this answer






























              2














              I am not sure this is the right answer, but my guess is that you will only be able to get the magnetic north because that's what the compass will give you.



              To "calculate" the true north, you will need your (or the phone's) location and then map that to find the right deviation. You could use some online tool or maybe based on maps you can try to have some simple formula to compute it... (can work if you target it to a specific area).



              Couple of notes also...




              • It will not be too precise anyway, you will always have errors introduced by the variation which is caused by the environment of the compass.

              • The difference between true and magnetic north changes constantly... not very fast, but over a couple of years, you'll definitely have a difference (depends how accurate you want to be)






              share|improve this answer




























                2












                2








                2







                I am not sure this is the right answer, but my guess is that you will only be able to get the magnetic north because that's what the compass will give you.



                To "calculate" the true north, you will need your (or the phone's) location and then map that to find the right deviation. You could use some online tool or maybe based on maps you can try to have some simple formula to compute it... (can work if you target it to a specific area).



                Couple of notes also...




                • It will not be too precise anyway, you will always have errors introduced by the variation which is caused by the environment of the compass.

                • The difference between true and magnetic north changes constantly... not very fast, but over a couple of years, you'll definitely have a difference (depends how accurate you want to be)






                share|improve this answer















                I am not sure this is the right answer, but my guess is that you will only be able to get the magnetic north because that's what the compass will give you.



                To "calculate" the true north, you will need your (or the phone's) location and then map that to find the right deviation. You could use some online tool or maybe based on maps you can try to have some simple formula to compute it... (can work if you target it to a specific area).



                Couple of notes also...




                • It will not be too precise anyway, you will always have errors introduced by the variation which is caused by the environment of the compass.

                • The difference between true and magnetic north changes constantly... not very fast, but over a couple of years, you'll definitely have a difference (depends how accurate you want to be)







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 21 '18 at 6:51









                Project

                358320




                358320










                answered Dec 12 '10 at 19:56









                MatthieuMatthieu

                13k85082




                13k85082






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f4423597%2fhow-to-get-real-north-and-magnetic-north-with-getorientation-function%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

                    Guess what letter conforming each word

                    Port of Spain

                    Run scheduled task as local user group (not BUILTIN)