From Projection WKT to ProjectionInfo

Feb 21, 2011 at 4:16 PM

Ciao,

there is an easy way to parse the Projection WKT into a ProjectionInfo?

 

...does exist even for the geometry?    i saw WKB parser but no WKT parser for the geometry!...    nothing for the Projection.

 

 

Thanks 

Alberto

Developer
Feb 22, 2011 at 5:39 AM

Hi,

Try ProjectionInfo.ReadEsriString()

Jiri

Feb 22, 2011 at 7:36 AM

Ciao,

ops...   i didn't try! eh e h

anyway.... i've this well known text projections...  it should be proj4 format.   and this text is parsed correctly from SharpMap proj library.

 

     string projectionWkt = @"PROJCS[""Google Mercator"",
                                      GEOGCS[""WGS 84"",
                                        DATUM[""World Geodetic System 1984"",
                                          SPHEROID[""WGS 84"", 6378137.0, 298.257223563, AUTHORITY[""EPSG"",""7030""]],
                                          AUTHORITY[""EPSG"",""6326""]],
                                        PRIMEM[""Greenwich"", 0.0, AUTHORITY[""EPSG"",""8901""]],
                                        UNIT[""degree"", 0.017453292519943295],
                                        AXIS[""Geodetic latitude"", NORTH],
                                        AXIS[""Geodetic longitude"", EAST],
                                        AUTHORITY[""EPSG"",""4326""]],
                                      PROJECTION[""Mercator_1SP""],
                                      PARAMETER[""semi_minor"", 6378137.0],
                                      PARAMETER[""latitude_of_origin"", 0.0],
                                      PARAMETER[""central_meridian"", 0.0],
                                      PARAMETER[""scale_factor"", 1.0],
                                      PARAMETER[""false_easting"", 0.0],
                                      PARAMETER[""false_northing"", 0.0],
                                      UNIT[""m"", 1.0],
                                      AXIS[""Easting"", EAST],
                                      AXIS[""Northing"", NORTH],
                                      AUTHORITY[""EPSG"",""900913""]]";

            DotSpatial.Projections.ProjectionInfo wgs84 = DotSpatial.Projections.KnownCoordinateSystems.Geographic.World.WGS1984;
            //DotSpatial.Projections.ProjectionInfo sphericalMercator = DotSpatial.Projections.KnownCoordinateSystems.Projected.WorldSpheroid.Mercatorsphere; 
            DotSpatial.Projections.ProjectionInfo sphericalMercator = new ProjectionInfo();
            sphericalMercator.ReadProj4String(projectionWkt);

I've try to load the wgs84 from known coordinate systems...  and the sphericalMercator, but i would like to compare with my projection i've used in other projects....   

But when i load it i get "Nothing" into spherical Mercator object.....   it seems it cannot recognize the projection??  

 

Ciao

Alberto

Feb 22, 2011 at 3:52 PM

problem solved....  the string is not proj4!!! but wkt! and those are different things!  sorry for disturb