Retrieving a Position

This example shows how to get the current position. This example uses the INavigate61 (GetPosition) method.

 

function GetPosition()

        {

            try

            {

                // get our current position

                var currentPos = sgworld.Navigate.GetPosition(3 /*AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE*/);

                // show details of current position

                alert("Current position in the world:\r\n" +

                        "Altitude = " + currentPos.Altitude + "\r\n" +

                        "AltitudeType = " +currentPos.AltitudeType + "\r\n" +

                        "Distance = " + currentPos.Distance+ "\r\n" +

                        "Yaw = " +currentPos.Yaw + "\r\n" +

                        "Pitch = " +currentPos.Pitch + "\r\n" +

                        "Roll = " +currentPos.Roll + "\r\n" +

                        "X = " +currentPos.X + "\r\n" +

                        "Y = " +currentPos.Y + "\r\n");

            }

            catch (ex)

            {

                alert("Unexpected error: " + ex.description);

            }       

        }