/// <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(GetProjectionString(projection)); var lat_lon = gkProjection.geodetic_to_grid(position.Latitude, position.Longitude); Latitude = lat_lon[0]; Longitude = lat_lon[1]; Projection = projection; }
/// <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(GetProjectionString(rt90projection)); var lat_lon = gkProjection.geodetic_to_grid(position.Latitude, position.Longitude); Latitude = lat_lon[0]; Longitude = lat_lon[1]; Projection = rt90projection; }
/// <summary> /// Convert the position to WGS84 format /// </summary> /// <returns></returns> public WGS84Position ToWGS84() { GaussKreuger gkProjection = new GaussKreuger(); gkProjection.swedish_params(ProjectionString); var lat_lon = gkProjection.grid_to_geodetic(Latitude, Longitude); WGS84Position newPos = new WGS84Position() { Latitude = lat_lon[0], Longitude = lat_lon[1], GridFormat = Grid.WGS84 }; return newPos; }