Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for a FREE C# class, library or set of functions that will allow me to generate a geodesic linestring (or array of vertices, whatever) from two decimal degree points.

I've found javascript functions that do what I want, but no luck with C# ones.

I suppose I could translate it from the above javascript. But I'd prefer to use something tried and tested.

Anyone know of such functions, classes or libraries?

share|improve this question

The pe.dll available with the free download of ArcGIS Explorer can be used to do this.

See Exploiting the ESRI Projection Engine (second edition) for discussion.

share|improve this answer
pe.dll doesn't seem to be .NET assembly or COM component because I get this when I try to "Add Reference" to it. – CaptDragon Jun 28 '12 at 17:18
Right, it's a good ol fashioned C style dll. Did you download Richie's sample app from arcscripts? It shows how to call this kind of dll. – Kirk Kuykendall Jun 28 '12 at 17:47
The first edition of that blog post covers the late binding to pe.dll:…. – Jay Cummins Jun 28 '12 at 17:50
@Kirk I looked through the code and did not see anything that would give me a geodesic line or vertices. It only gives geodesic distance, azimuth and a single coordinate. I need a LINE or array of vertices that represents the geodesic line. – CaptDragon Jun 28 '12 at 17:52
What if you find the distance first, then iteratively step towards the TO point via the azimuth function by some fraction of that distance, collecting coordinates in a list as you go? – Kirk Kuykendall Jun 28 '12 at 19:50

A few resources for different languages (except C#) are listed here:

One of them is a PROJ.4 utility geod, which probably has some underlying API. Check out Proj4Net, but I've never used it, and I'm not sure how mature or complete it is.

share|improve this answer

Sorry I can't be more helpful, I can only point in the direction of possibilities, not having had to calculate Geodesics myself.

One option I just found via NuGet System.Spatial

Another option might be one of the ports of JTS to C#. One of these is (can't remember, there is another one as well...

Another .NET spatial library is

Yet another option may be in combination with Microsoft.SqlServer.Spatial.Types assembly. There is a Nuget package of the same name and it comes built in with Sql Server Express (or standard) from version 2008 onwards. Don't be fooled by the Sql Server name though, you might have to use Sql Server types, but you can do spatial operations entirely within code. Pretty limited though, especially projection wise.

All of the above have NuGet packages, so load em up, and try em out. Unfortunately, none of these is really obvious how to get the geometry of a geodesic, but with some projection love, I reckon it would be doable.

My thinking, although it may well be wrong, would be (using perhaps the System.Spatial) to create the line as a Geography type, then reproject to your target geometry type SRID. My knowledge of Geodesics is foggy at best though.

share|improve this answer
I'd like to see an answer showing how to use one of the native .NET libraries to do this! – blah238 Jun 29 '12 at 5:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.