コード例 #1
0
        /// <summary>
        /// Returns a string representing the lla coord in arc minutes and seconds
        /// </summary>
        /// <param name="lla"></param>
        /// <returns></returns>
        public static string LlaDegreesToArcMinSecs(LLACoord lla)
        {
            double latDegFrac = lla.lat % 1;
            double latDeg = lla.lat - latDegFrac;
            double latMinFull = latDegFrac * 60.0;
            double latSecondsInMins = latMinFull % 1;
            double latMin = latMinFull - latSecondsInMins;
            double latSeconds = latSecondsInMins * 60.0;
            string nString = latDeg.ToString() + " " + latMin.ToString() + "' " + latSeconds.ToString("F6") + "\" N";

            double lonDegFrac = -lla.lon % 1;
            double lonDeg = -lla.lon - lonDegFrac;
            double lonMinFull = lonDegFrac * 60.0;
            double lonSecondsInMins = lonMinFull % 1;
            double lonMin = lonMinFull - lonSecondsInMins;
            double lonSeconds = lonSecondsInMins * 60.0;
            string eString = lonDeg.ToString() + " " + lonMin.ToString() + "' " + lonSeconds.ToString("F6") + "\" W";

            return nString + "\n" + eString;
        }
コード例 #2
0
        /// <summary>
        /// LLA coord in degrees
        /// </summary>
        /// <param name="coordiante"></param>
        /// <param name="proj"></param>
        /// <returns></returns>
        public static LLACoord XyToLlaDegrees(Coordinates coordiante, PlanarProjection proj)
        {
            // radians
            LLACoord llaRad = XyToLlaRadians(coordiante, proj);

            // degrees
            LLACoord lla = new LLACoord(llaRad.lat * 180.0 / Math.PI, llaRad.lon * 180.0 / Math.PI, 0);

            // return
            return lla;
        }