ApsNadcon .NET Library

ApsNadcon.IsInsideNadconRegion Method

Checks if a geographic coordinate is inside the specified NADCON region.

public static bool IsInsideNadconRegion(
   double latInDeg,
   double lonInDeg,
   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 geographic coordinate is inside the specified NADCON region, false - if it is outside the specified NADCON region, or an error occurred

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).

Example

This sample shows how to call the ApsNadcon.IsInsideNadconRegion 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.IsInsideNadconRegion(latInDeg, lonInDeg, nadconRegion, out errorMessage))
{
    Console.WriteLine("Is outside or error: " + errorMessage);
}
else
{
    Console.WriteLine("Inside");
}

See Also

ApsNadcon Class | ApsNadcon Namespace