diff --git a/src/Nest/QueryDsl/Geo/GeoLocation.cs b/src/Nest/QueryDsl/Geo/GeoLocation.cs index c12d19b8838..72e7ffc3468 100644 --- a/src/Nest/QueryDsl/Geo/GeoLocation.cs +++ b/src/Nest/QueryDsl/Geo/GeoLocation.cs @@ -82,7 +82,7 @@ public static GeoLocation TryCreate(double latitude, double longitude) public override string ToString() { - return string.Format(CultureInfo.InvariantCulture, "{0},{1}", _latitude, _longitude); + return _latitude.ToString("#0.0#######") + "," + _longitude.ToString("#0.0#######"); } public bool Equals(GeoLocation other) @@ -112,6 +112,9 @@ public override int GetHashCode() => public static implicit operator GeoLocation(string latLon) { + if (string.IsNullOrEmpty(latLon)) + throw new ArgumentNullException(nameof(latLon)); + var parts = latLon.Split(','); if (parts.Length != 2) throw new ArgumentException("Invalid format: string must be in the form of lat,lon"); double lat;