

Код: Выделить всё
using System;
using System.Runtime.InteropServices;
namespace ProjApi
{
public class Proj
{
[DllImport("proj.dll", CharSet=CharSet.Ansi, CallingConvention=CallingConvention.Cdecl)]
public static extern int pj_transform(IntPtr src, IntPtr dst,
int point_count, int point_offset,
[InAttribute, OutAttribute] double[] x,
[InAttribute, OutAttribute] double[] y,
[InAttribute, OutAttribute] double[] z);
[DllImport("proj.dll", CharSet=CharSet.Ansi, CallingConvention=CallingConvention.Cdecl)]
public static extern IntPtr pj_init_plus(
[MarshalAs(UnmanagedType.LPStr)] string pjstr);
}
}
using System;
using System.Runtime.InteropServices;
using ProjApi;
public class ProjApiTest {
static void Main(string[] args)
{
IntPtr src = Proj.pj_init_plus("+proj=latlong +ellps=WGS84 +datum=WGS84");
IntPtr dst = Proj.pj_init_plus("+proj=latlong +ellps=krass"
+" +towgs84=23.92,-141.27,-80.9,0,0.35,0.82,0.12 -f '%.10f'");
double[] x ={ 50 };
double[] y ={ 50 };
double[] z ={ 0 };
int res = Proj.pj_transform(src, dst, x.Length, 1, x, y, z);
Console.WriteLine(x[0]);
Console.WriteLine(y[0]);
}
}