2
Vote

CreateFromWkt throws MissingMethodException in CF 2.0

description

Using Proj.NET in CompactFrameWork 2.0 will (with some wkt coordinatesystems) throw a MissingMethodException (TryParse System.Int64)
 
Sample code:
 
    const string UTMWGS84_WKT = "PROJCS[\"WGS 84 / UTM zone 32N\"," +
                                        "GEOGCS[\"WGS 84\"," +
                                        "DATUM[\"WGS_1984\"," +
                                        "SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]]," +
                                        "AUTHORITY[\"EPSG\",\"6326\"]]," +
                                        "PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]]," +
                                        "UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]]," +
                                        "AUTHORITY[\"EPSG\",\"4326\"]]," +
                                        "PROJECTION[\"Transverse_Mercator\"]," +
                                        "PARAMETER[\"latitude_of_origin\",0]," +
                                        "PARAMETER[\"central_meridian\",9]," +
                                        "PARAMETER[\"scale_factor\",0.9996]," +
                                        "PARAMETER[\"false_easting\",500000]," +
                                        "PARAMETER[\"false_northing\",0]," +
                                        "UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]," +
                                        "AUTHORITY[\"EPSG\",\"32632\"]]";
 
    const string WGS84_WKT = "GEOGCS[\"GCS_WGS_1984\"," +
                                     "DATUM[\"D_WGS_1984\"," +
                                     "SPHEROID[\"WGS_1984\",6378137,298.257223563]]," +
                                     "PRIMEM[\"Greenwich\",0]," +
                                     "UNIT[\"Degree\",0.0174532925199433]]";
 
            ICoordinateSystemFactory CF = new CoordinateSystemFactory();
            ICoordinateSystem sourceC = CF.CreateFromWkt(WGS84_WKT);
            ICoordinateSystem targetC = CF.CreateFromWkt(UTMWGS84_WKT);    //This throws a MissingMethodException
 
           ICoordinateTransformationFactory CTF = new CoordinateTransformationFactory();
           ICoordinateTransformation WGS84CoordinateTransformation = CTF.CreateFromCoordinateSystems(sourceC, targetC);
 
         double[] wgs84 = new double[] { 11.722588, 55.7156179};
         double[] utm32 = WGS84CoordinateTransformation.MathTransform.Transform(wgs84);

comments

Helsted wrote Jul 14, 2009 at 8:23 AM

Seems to be related to the long.tryparse in WKTStreamTokenizer.ReadAuthority.

Building with Conditional Compile Symbol Silverlight would to be a valid workaround.

wrote Sep 24, 2009 at 4:46 PM

wrote Feb 21, 2013 at 11:06 PM