PurplePen.CoordinateMapper.GetLatLong C# (CSharp) Method

GetLatLong() public method

public GetLatLong ( PointF paperCoord, double &latitude, double &longitude ) : bool
paperCoord System.Drawing.PointF
latitude double
longitude double
return bool
        public bool GetLatLong(PointF paperCoord, out double latitude, out double longitude)
        {
            latitude = longitude = 0;

            try {
                // Convert paper coord to real world coord. Must use double rather than Matrix to
                // keep precision.
                double realX, realY;
                if (!GetRealWorld(paperCoord, out realX, out realY))
                    return false;

                double[] xy = { realX, realY };
                double[] z = {1};
                Reproject.ReprojectPoints(xy, z, mapProjection, wgs1984Projection, 0, 1);
                longitude = xy[0];
                latitude = xy[1];

            }
            catch (ProjectionException) {
                return false;
            }

            return true;
        }