datum convertion

Topics: Algorithms, Data Access, SharpMap Project, SharpMap v0.9 / v1.x
Apr 13, 2010 at 9:28 PM
Edited Apr 14, 2010 at 2:43 AM

i'm using this function to convert data , this work very well  with nad83 but i also have data in nad 27 and in the convertion the shift between datum seen to be missing

if I understand its missing me a parameter the towgs84 but i dont know how to find it

 

public const string EPSG32087 = "PROJCS[\"NAD27 / MTM zone 7\",GEOGCS[\"GCS_North_American_1927\",DATUM[\"D_North_American_1927\",SPHEROID[\"Clarke_1866\",6378206.4,294.9786982138982]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",-70.5],PARAMETER[\"scale_factor\",0.9999],PARAMETER[\"false_easting\",304800],PARAMETER[\"false_northing\",0],PARAMETER[\"TOWGS84\",0],UNIT[\"Meter\",1]]"; <font size="2">

 

</font>

 

public const string strWGS83 = "GEOGCS[\"GCS_North_American_1983\",DATUM[\"D_North_American_1983\",SPHEROID[\"GRS_1980\",6378137.0,298.257222101]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]]";

 

private static ICoordinateSystem GetMercatorProjection()
{
         
 IProjectedCoordinateSystem sCin = SharpMap.Converters.WellKnownText.CoordinateSystemWktReader.Parse(EPSG32087) as IProjectedCoordinateSystem;
 return sCin;
}

public double[] MercatorToWgs84LatLon(double[] values)
{
  var mercator = GetMercatorProjection();
  var latlon = (IGeographicCoordinateSystem)SharpMap.Converters.WellKnownText.CoordinateSystemWktReader.Parse(strWGS83);
  var ctfac = new CoordinateTransformationFactory();
  var transformation = ctfac.CreateFromCoordinateSystems(mercator, latlon);
 var transform = transformation;
 var converted = transform.MathTransform.Transform(values);
 return converted;
}