1Imports NETGeographicLib
2
3Module example_AlbersEqualArea
4    Sub Main()
5        Try
6            Dim lat1 As Double = 40 + 58 / 60.0 : Dim lat2 As Double = 39 + 56 / 60.0 ' standard parallels
7            Dim k1 As Double = 1  ' scale
8            Dim lon0 As Double = -77 - 45 / 60.0 ' Central meridian
9            ' Set up basic projection
10            Dim albers As AlbersEqualArea = New AlbersEqualArea(Constants.WGS84.EquatorialRadius,
11                                                                Constants.WGS84.Flattening,
12                                                                lat1, lat2, k1)
13            ' Sample conversion from geodetic to Albers Equal Area
14            Dim lat As Double = 39.95 : Dim lon As Double = -75.17  ' Philadelphia
15            Dim x, y As Double
16            albers.Forward(lon0, lat, lon, x, y)
17            Console.WriteLine(String.Format("X: {0} Y: {1}", x, y))
18            ' Sample conversion from Albers Equal Area grid to geodetic
19            x = 220000.0 : y = -53000.0
20            albers.Reverse(lon0, x, y, lat, lon)
21            Console.WriteLine(String.Format("Latitude: {0} Longitude: {1}", lat, lon))
22        Catch ex As GeographicErr
23            Console.WriteLine(String.Format("Caught exception: {0}", ex.Message))
24        End Try
25    End Sub
26End Module
27