How to transform from any to wgs 1984?

Topics: General Topics, SharpMap Project, SharpMap v0.9 / v1.x, WinForms Controls
Dec 26, 2010 at 12:59 PM
Edited Dec 26, 2010 at 1:25 PM

How can i transfor from any to wgs 1984 on the shp file or postgis layer?

i working on winapp.

Thanks

Editor
Dec 27, 2010 at 3:29 PM

Hi!

You need to create the required transformation

string wkt ="your wkt definition";
//source
ProjNet.CoordinateSystems.ICoordinateSystem src = ProjNet.Converters.WellKnownText.CoordinateSystemWktReader.Parse(wkt) as ProjNet.CoordinateSystems.ICoordinateSystem;
//destination
ProjNet.CoordinateSystems.ICoordinateSystem wgs84 = ProjNet.CoordinateSystems.GeographicCoordinateSystem.WGS84;
//transformation
ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory ctfc = new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory(); 
ProjNet.CoordinateSystems.Transformations.ICoordinateTransformation transform = ctfc.CreateFromCoordinateSystems(src, wgs84);

//point to transform
double X; 
double Y; 
//result array with two members (x & y)
double[] gkt = transform.MathTransform.Transform(new double[] { X, Y });

Be sure to reference ProjNet in you project

Goran

Dec 28, 2010 at 11:35 PM

Hi

Thanks Goran, this code worked as good.

 

Apr 2, 2011 at 4:28 AM
Edited Apr 2, 2011 at 4:31 AM

hi GoranSiska

please provide an example of wkt (vietnam coordinate systems standard or another coordinate system) . I working with vn-2000 (vietnam coordinate systems standard). (but vietnam coordinate systems standard for wkt is good ). I very need.

 

Thank you very much.

Editor
Apr 3, 2011 at 8:02 AM

Hi!

The best source for WKT's is http://spatialreference.org/. Searching for vn 2000 returns multiple results so I suggest you try it yourself an determine which one you are working with. An example of wkt:

PROJCS["VN-2000 / UTM zone 49N",
    GEOGCS["VN-2000",
        DATUM["Vietnam_2000",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6756"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.01745329251994328,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4756"]],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",111],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    AUTHORITY["EPSG","3406"],
    AXIS["Easting",EAST],
    AXIS["Northing",NORTH]]
Goran