ApsNadcon .NET Library

ApsNadcon.FindNadconRegion Method

Determines NADCON region to which the specified geographic coordinate belongs.

public static bool FindNadconRegion(
   double latInDeg,
   double lonInDeg,
   out ApsNadconRegion nadconRegion,
   out string errorMessage
);

Parameters

latInDeg
a latitude in the decimal degrees
lonInDeg
a longitude in the decimal degrees
nadconRegion
a NADCON region
errorMessage
an error message, passed by reference (out), that contains detailed error / warning information

Return Value

true - if the NADCON region is found, false - if it is not found, or an error happend

Remarks

The function verifies validity of the input arguments before running the conversion. The valid latitude is a real number in the range from -90.0 (inclusive) to 90.0 (inclusive). The valid longitude is a real number in the range from -180.0 (inclusive) to -180.0 (inclusive). The function returns false, if the geographic coordinate is outside all NADCON regions.

Example

This sample shows how to call the ApsNadcon.FindNadconRegion method from C# code:

double latInDeg = 45.13;
double lonInDeg = -120.1313;

ApsNadconRegion nadconRegion = ApsNadconRegion.ConterminousUS;

string errorMessage = String.Empty;

Console.WriteLine("Lat: " + latInDeg.ToString());
Console.WriteLine("Lon: " + lonInDeg.ToString());

if (!ApsNadcon.FindNadconRegion(latInDeg, lonInDeg, out nadconRegion, out errorMessage))
{
    Console.WriteLine("Not found: " + errorMessage);
}
else
{
    Console.WriteLine("Found:" + nadconRegion);
}

See Also

ApsNadcon Class | ApsNadcon Namespace