private void DoTransform(Proj4Projection srcPrj, Proj4Projection desPrj, ShapePoint[] points) { double[] xs = new double[points.Length]; double[] ys = new double[points.Length]; for (int i = 0; i < points.Length; i++) { xs[i] = points[i].X; ys[i] = points[i].Y; } Proj4Projection.Transform(srcPrj, desPrj, xs, ys); // for (int i = 0; i < points.Length; i++) { points[i].X = xs[i]; points[i].Y = ys[i]; } }
/// <summary> /// Transform coordinates from one projection system to another /// </summary> /// <param name="src">The source projection</param> /// <param name="dst">The destination projection</param> /// <param name="x">The "X" coordinate values.</param> /// <param name="y">The "Y" coordinate values.</param> /// <exception cref="System.ApplicationException">Thrown when the projection is /// not initialized or the transformation failed. The message will indicate the error. /// </exception> /// <exception cref="System.ArgumentException"> /// May be thrown for any of the following reasons: /// <list type="bullet"> /// <item>The "x" array is null</item> /// <item>The "y" array is null</item> /// <item>The length of the x and y arrays don't match</item> /// </list> /// </exception> public static void Transform(Proj4Projection src, Proj4Projection dst, double[] x, double[] y) { Proj4Projection.Transform(src, dst, x, y, null); }
public void InverTransform(double[] xs, double[] ys) { Proj4Projection.Transform(_dstProjection, _srcProjection, xs, ys); }
/// <summary> /// Transform coordinates from one projection system to another /// </summary> /// <param name="dst">The destination projection</param> /// <param name="x">The "X" coordinate values.</param> /// <param name="y">The "Y" coordinate values.</param> /// <param name="z">The "Z" coordinate values.</param> /// <exception cref="System.ApplicationException">Thrown when the projection is /// not initialized or the transformation failed. The message will indicate the error. /// </exception> /// <exception cref="System.ArgumentException"> /// May be thrown for any of the following reasons: /// <list type="bullet"> /// <item>The "x" array is null</item> /// <item>The "y" array is null</item> /// <item>The length of the x, y and z (if not null) arrays don't match</item> /// </list> /// </exception> public void Transform(Proj4Projection dst, double[] x, double[] y, double[] z) { Proj4Projection.Transform(this, dst, x, y, z); }