/// <summary>
        /// Create a RT90 position by converting a WGS84 position
        /// </summary>
        /// <param name="position">WGS84 position to convert</param>
        /// <param name="rt90projection">Projection to convert to</param>
        public SWEREF99Position(WGS84Position position, SWEREFProjection projection)
            : base(Grid.SWEREF99)
        {
            GaussKreuger gkProjection = new GaussKreuger();

            gkProjection.swedish_params(this.GetProjectionString(projection));
            var lat_lon = gkProjection.geodetic_to_grid(position.Latitude, position.Longitude);

            this.Latitude   = lat_lon[0];
            this.Longitude  = lat_lon[1];
            this.Projection = projection;
        }
예제 #2
0
        /// <summary>
        /// Create a RT90 position by converting a WGS84 position
        /// </summary>
        /// <param name="position">WGS84 position to convert</param>
        /// <param name="rt90projection">Projection to convert to</param>
        public RT90Position(WGS84Position position, RT90Projection rt90projection)
            : base(Grid.RT90)
        {
            GaussKreuger gkProjection = new GaussKreuger();

            gkProjection.swedish_params(this.GetProjectionString(rt90projection));
            var lat_lon = gkProjection.geodetic_to_grid(position.Latitude, position.Longitude);

            this.Latitude   = lat_lon[0];
            this.Longitude  = lat_lon[1];
            this.Projection = rt90projection;
        }
        /// <summary>
        /// Convert the position to WGS84 format
        /// </summary>
        /// <returns></returns>
        public WGS84Position ToWGS84()
        {
            GaussKreuger gkProjection = new GaussKreuger();

            gkProjection.swedish_params(this.ProjectionString);
            var lat_lon = gkProjection.grid_to_geodetic(this.Latitude, this.Longitude);

            WGS84Position newPos = new WGS84Position()
            {
                Latitude  = lat_lon[0],
                Longitude = lat_lon[1]
            };

            return(newPos);
        }