Is there a .NET library to calculate area enclosed by polygon made up of geo coordinates (lat longs)?
|
SharpMap has a polygon class with an Area method. But before calling that, you should consider projecting the polygon's coordinates into an equal area projection to yield meaningful results. It looks like SharpMap uses ProjNet, which has Albers, but I also see there is now a c# wrapper for Proj4. |
|||
|
|
|
NetTopologySuite offer what you need, and much more: http://code.google.com/p/nettopologysuite/ |
|||
|
|
Another option is using the Microsoft.SqlServer.Types library. While it isn't supplied in .NET, it is available as a nuget package, or you can find it in your SqlServer (or Express) installation (%programfiles%\Microsoft SQL Server\100\SDK\Assemblies) as Microsoft.SqlServer.Types.dll Obviously, it relies on Microsoft (and the SQL types library which could have it's own licencing issues), so the other options supplied may well be better options, but if you are already integrating with SqlServer 2008, then this may be a nice way to go. To do an area calculation is pretty simple (I have included an NUnit test below demonstrating it.
|
|||||
|