diff --git a/src/GeoJSON.Net/GeoJSON.Net.csproj b/src/GeoJSON.Net/GeoJSON.Net.csproj index c6f58e3a..67cb70a0 100644 --- a/src/GeoJSON.Net/GeoJSON.Net.csproj +++ b/src/GeoJSON.Net/GeoJSON.Net.csproj @@ -3,8 +3,8 @@ netstandard1.0;netstandard1.1;net35;net40;net45; GeoJSON.Net - 1.0.0 - 1.0.0 + 1.1.72 + 1.1.72 .Net types for the GeoJSON RFC to be used with Json.Net GeoJSON.Net diff --git a/src/GeoJSON.Net/Geometry/Position.cs b/src/GeoJSON.Net/Geometry/Position.cs index 93bbfe44..0228980f 100644 --- a/src/GeoJSON.Net/Geometry/Position.cs +++ b/src/GeoJSON.Net/Geometry/Position.cs @@ -17,22 +17,12 @@ public class Position : IPosition, IEqualityComparer, IEquatable /// Initializes a new instance of the class. /// - /// The latitude. - /// The longitude. + /// The latitude, or Y coordinate. + /// The longitude or X coordinate. /// The altitude in m(eter). public Position(double latitude, double longitude, double? altitude = null) { - // Yes I hate commented out code to, but this needs to go right now - //if (Math.Abs(latitude) > 90) - //{ - // throw new ArgumentOutOfRangeException(nameof(latitude), "Latitude must be a proper lat (+/- double) value between -90 and 90."); - //} - - //if (Math.Abs(longitude) > 180) - //{ - // throw new ArgumentOutOfRangeException(nameof(longitude), "Longitude must be a proper lon (+/- double) value between -180 and 180."); - //} - + // TODO Coordinate range validation should be performed only when CRS is supplied Latitude = latitude; Longitude = longitude; Altitude = altitude; @@ -41,11 +31,12 @@ public Position(double latitude, double longitude, double? altitude = null) /// /// Initializes a new instance of the class. /// - /// The latitude, e.g. '38.889722'. - /// The longitude, e.g. '-77.008889'. + /// The latitude, or Y coordinate e.g. '38.889722'. + /// The longitude, or X coordinate e.g. '-77.008889'. /// The altitude in m(eters). public Position(string latitude, string longitude, string altitude = null) { + // TODO Coordinate range validation should be performed only when CRS is supplied if (string.IsNullOrEmpty(latitude)) { throw new ArgumentOutOfRangeException(nameof(latitude), "May not be empty."); @@ -56,14 +47,14 @@ public Position(string latitude, string longitude, string altitude = null) throw new ArgumentOutOfRangeException(nameof(longitude), "May not be empty."); } - if (!double.TryParse(latitude, NumberStyles.Float, CultureInfo.InvariantCulture, out double lat) || Math.Abs(lat) > 90) + if (!double.TryParse(latitude, NumberStyles.Float, CultureInfo.InvariantCulture, out double lat)) { - throw new ArgumentOutOfRangeException(nameof(latitude), "Latitude must be a proper lat (+/- double) value between -90 and 90."); + throw new ArgumentOutOfRangeException(nameof(altitude), "Latitude representation must be a numeric."); } - if (!double.TryParse(longitude, NumberStyles.Float, CultureInfo.InvariantCulture, out double lon) || Math.Abs(lon) > 180) + if (!double.TryParse(longitude, NumberStyles.Float, CultureInfo.InvariantCulture, out double lon)) { - throw new ArgumentOutOfRangeException(nameof(longitude), "Longitude must be a proper lon (+/- double) value between -180 and 180."); + throw new ArgumentOutOfRangeException(nameof(altitude), "Longitude representation must be a numeric."); } Latitude = lat; @@ -86,12 +77,12 @@ public Position(string latitude, string longitude, string altitude = null) public double? Altitude { get; } /// - /// Gets the latitude. + /// Gets the latitude or Y coordinate /// public double Latitude { get; } /// - /// Gets the longitude. + /// Gets the longitude or X coordinate /// public double Longitude { get; }