/// <summary> /// Transforms a <see cref="SharpMap.Geometries.Point"/>. /// </summary> /// <param name="p">Point to transform</param> /// <param name="from">Source Projection</param> /// <param name="to">Target Projection</param> /// <returns>Transformed Point</returns> public static Point TransformPoint(Point p, ProjectionInfo from, ProjectionInfo to) { try { double[] coords = p.ToDoubleArray(); Reproject.ReprojectPoints(coords, null, from, to, 0, 1); return new Point(coords); } catch { return null; } }
/// <summary> /// Transforms a <see cref="SharpMap.Geometries.Point"/>. /// </summary> /// <param name="p">Point to transform</param> /// <param name="transform">MathTransform</param> /// <returns>Transformed Point</returns> public static Point TransformPoint(Point p, IMathTransform transform) { try { return new Point(transform.Transform(p.ToDoubleArray())); } catch { return null; } }