-
Notifications
You must be signed in to change notification settings - Fork 39
Coordinate
Simon Bartlett edited this page Jan 26, 2013
·
2 revisions
The Coordinate type represents a set of coordinates:
- Latitude
- Longitude
- Elevation (metres)
- Measure
Geo does not support any geodisic calculations or operations on the Elevation or Measure coordinates.
var latitude = 34.869;
var longitude = 67.98;
var elevation = 789.93
var myCoordinate1 = new Coordinate(latitude, longitude);
var myCoordinate2 = new Coordinate(latitude, longitude, elevation);
The constructor will throw a ArgumentOutOfRangeException if
- Latitude is greater than 90, or less than -90.
- Longitude is greater than 180, or less than -180.
The Coordinate type supports longitude wrapping. When configured do so, Geo will wrap the longitude value; so for example if Latitude was 390, the Coordinate type would wrap the value to become 30. Here's a code sample:
GeoContext.Current.LongitudeWrapping = true;
var coordinate1 = new Coordinate(0, 30);
var coordinate2 = new Coordinate(0, 390);
Assert.AreEqual(coordinate1, coordinate2); // true!
Assert.AreEqual(coordinate2.Longitude, 30d); // true!
The Coordinate type also has static methods to parse strings that contain a set of coordinates.
var myCoordinate = Coordinate.Parse("12 34.56'N 123 45.55'E");