Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

3 Answers 3

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: kiwigis.blogspot.com/2009/05/…. –  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: http://trac.osgeo.org/proj/wiki/GeodesicCalculations

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...http://code.google.com/p/nettopologysuite/

Another .NET spatial library is http://dotspatial.codeplex.com

Yet another option may be http://sqlspatialtools.codeplex.com/ 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

 
discard

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.