Skip to content

Commit ab6fad4

Browse files
committed
- coordinates are not validated against geographic coordinate bounds, can now be any numeric
- assembly file version matching nuget package version
1 parent 88e1d52 commit ab6fad4

File tree

2 files changed

+14
-23
lines changed

2 files changed

+14
-23
lines changed

src/GeoJSON.Net/GeoJSON.Net.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<PropertyGroup>
44
<TargetFrameworks>netstandard1.0;netstandard1.1;net35;net40;net45;</TargetFrameworks>
55
<AssemblyName>GeoJSON.Net</AssemblyName>
6-
<AssemblyVersion>1.0.0</AssemblyVersion>
7-
<FileVersion>1.0.0</FileVersion>
6+
<AssemblyVersion>1.1.72</AssemblyVersion>
7+
<FileVersion>1.1.72</FileVersion>
88
<Description>.Net types for the GeoJSON RFC to be used with Json.Net</Description>
99
<Authors></Authors>
1010
<Company>GeoJSON.Net</Company>

src/GeoJSON.Net/Geometry/Position.cs

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,12 @@ public class Position : IPosition, IEqualityComparer<Position>, IEquatable<Posit
1717
/// <summary>
1818
/// Initializes a new instance of the <see cref="Position" /> class.
1919
/// </summary>
20-
/// <param name="latitude">The latitude.</param>
21-
/// <param name="longitude">The longitude.</param>
20+
/// <param name="latitude">The latitude, or Y coordinate.</param>
21+
/// <param name="longitude">The longitude or X coordinate.</param>
2222
/// <param name="altitude">The altitude in m(eter).</param>
2323
public Position(double latitude, double longitude, double? altitude = null)
2424
{
25-
// Yes I hate commented out code to, but this needs to go right now
26-
//if (Math.Abs(latitude) > 90)
27-
//{
28-
// throw new ArgumentOutOfRangeException(nameof(latitude), "Latitude must be a proper lat (+/- double) value between -90 and 90.");
29-
//}
30-
31-
//if (Math.Abs(longitude) > 180)
32-
//{
33-
// throw new ArgumentOutOfRangeException(nameof(longitude), "Longitude must be a proper lon (+/- double) value between -180 and 180.");
34-
//}
35-
25+
// TODO Coordinate range validation should be performed only when CRS is supplied
3626
Latitude = latitude;
3727
Longitude = longitude;
3828
Altitude = altitude;
@@ -41,11 +31,12 @@ public Position(double latitude, double longitude, double? altitude = null)
4131
/// <summary>
4232
/// Initializes a new instance of the <see cref="Position" /> class.
4333
/// </summary>
44-
/// <param name="latitude">The latitude, e.g. '38.889722'.</param>
45-
/// <param name="longitude">The longitude, e.g. '-77.008889'.</param>
34+
/// <param name="latitude">The latitude, or Y coordinate e.g. '38.889722'.</param>
35+
/// <param name="longitude">The longitude, or X coordinate e.g. '-77.008889'.</param>
4636
/// <param name="altitude">The altitude in m(eters).</param>
4737
public Position(string latitude, string longitude, string altitude = null)
4838
{
39+
// TODO Coordinate range validation should be performed only when CRS is supplied
4940
if (string.IsNullOrEmpty(latitude))
5041
{
5142
throw new ArgumentOutOfRangeException(nameof(latitude), "May not be empty.");
@@ -56,14 +47,14 @@ public Position(string latitude, string longitude, string altitude = null)
5647
throw new ArgumentOutOfRangeException(nameof(longitude), "May not be empty.");
5748
}
5849

59-
if (!double.TryParse(latitude, NumberStyles.Float, CultureInfo.InvariantCulture, out double lat) || Math.Abs(lat) > 90)
50+
if (!double.TryParse(latitude, NumberStyles.Float, CultureInfo.InvariantCulture, out double lat))
6051
{
61-
throw new ArgumentOutOfRangeException(nameof(latitude), "Latitude must be a proper lat (+/- double) value between -90 and 90.");
52+
throw new ArgumentOutOfRangeException(nameof(altitude), "Latitude representation must be a numeric.");
6253
}
6354

64-
if (!double.TryParse(longitude, NumberStyles.Float, CultureInfo.InvariantCulture, out double lon) || Math.Abs(lon) > 180)
55+
if (!double.TryParse(longitude, NumberStyles.Float, CultureInfo.InvariantCulture, out double lon))
6556
{
66-
throw new ArgumentOutOfRangeException(nameof(longitude), "Longitude must be a proper lon (+/- double) value between -180 and 180.");
57+
throw new ArgumentOutOfRangeException(nameof(altitude), "Longitude representation must be a numeric.");
6758
}
6859

6960
Latitude = lat;
@@ -86,12 +77,12 @@ public Position(string latitude, string longitude, string altitude = null)
8677
public double? Altitude { get; }
8778

8879
/// <summary>
89-
/// Gets the latitude.
80+
/// Gets the latitude or Y coordinate
9081
/// </summary>
9182
public double Latitude { get; }
9283

9384
/// <summary>
94-
/// Gets the longitude.
85+
/// Gets the longitude or X coordinate
9586
/// </summary>
9687
public double Longitude { get; }
9788

0 commit comments

Comments
 (0)