[PROJ] Interface to PROJ from C#

Paul Harwood runette at gmail.com
Fri Jan 6 02:07:06 PST 2023


HI

Might I politely suggest that you should think about asking effective
questions? It is not clear from this what you are actually asking.

My interpretation is that the vcpkg thing is not the question (so it would
be nice if that was not the start of the email - it is FYI info).

It looks like you are asking for help with PInvoke and Proj in C#. That is
not going to be an easy ask - since it is not a supported environment in
Proj and PInvoke is at best a dark art.

It is not clear from the question if proj_create_crs_to_crs is a method
that works or one that does not work. If it does not work - what is the
problem/error message?

As a general note - what I do since I do not want to have an unsupported
Pinvoke interface is to use GDAL. This has supported C# bindings and does
expose at least some of the Proj functionality as the OSR ABI. Not an ideal
solution but workable and supported.

On Thu, 5 Jan 2023 at 20:27, Jason Dick <JasonD at thetranstecgroup.com> wrote:

> I used vcpkg. I used the instructions from the web site:
>
> https://proj.org/install.html
>
> It did take me awhile to get it working because I needed to customize the
> process. But now that the DLL is built by default, that's less necessary.
>
> I only use a handful of functions and there are some that I didn't know
> how to convert to C#. Here's an example of one import that I use.
>
> private const String ProjDLL = "proj.dll";
>
> // PJ *proj_create_crs_to_crs(PJ_CONTEXT *ctx, const char *source_crs,
> const char *target_crs, PJ_AREA *area)
> [DllImport(ProjDLL, CallingConvention = CallingConvention.Cdecl, CharSet =
> CharSet.Ansi, BestFitMapping = false, ThrowOnUnmappableChar = true)]
> private static extern IntPtr proj_create_crs_to_crs(IntPtr ctx, String
> source_crs, String target_crs, IntPtr area);
> _______________________________________________
> PROJ mailing list
> PROJ at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/proj
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20230106/329a129d/attachment.htm>


More information about the PROJ mailing list