Example #1
0
        public static List <GPoint> LonLat2XY(List <GPoint> points)
        {
            List <WGS8LonLat> posList = new List <WGS8LonLat>(points.Count);

            foreach (var p in points)
            {
                posList.Add(new WGS8LonLat(p.X, p.Y));
            }

            return(WGS8GeoCoordinate.ToPlaneCoordinate(posList));
        }
        private void RegisterFormulas()
        {
            // longitude to X on plane coordinates
            FormulaExtension.CustomFunctions["LON"] = (cell, args) => {
                if ((args.Length != 3) || !(args[0] is double) || !(args[1] is double) || !(args[2] is double))
                {
                    return("Arguments should be longitude, latitude and start longitude");
                }

                return(WGS8GeoCoordinate.Lon2X((double)args[0], (double)args[1], (double)args[2]));
            };

            // latitude to Y on plane coordinates
            FormulaExtension.CustomFunctions["LAT"] = (cell, args) => {
                if ((args.Length != 2) || !(args[0] is double) || !(args[1] is double))
                {
                    return("Arguments should be latitude and start latitude");
                }

                return(WGS8GeoCoordinate.Lat2Y((double)args[0], (double)args[1]));
            };
        }