diff --git a/src/Geocoding/ForwardGeocodeResource.cs b/src/Geocoding/ForwardGeocodeResource.cs index dca8a68..a19a9d0 100644 --- a/src/Geocoding/ForwardGeocodeResource.cs +++ b/src/Geocoding/ForwardGeocodeResource.cs @@ -148,7 +148,7 @@ public override string GetUrl() if (this.Proximity != null) { var nonNullableProx = (Vector2d)this.Proximity; - opts.Add("proximity", nonNullableProx.ToString()); + opts.Add("proximity", nonNullableProx.SerializeToLonLat()); } if (this.Types != null) diff --git a/src/Geocoding/ReverseGeocodeResource.cs b/src/Geocoding/ReverseGeocodeResource.cs index 8d60464..133e141 100644 --- a/src/Geocoding/ReverseGeocodeResource.cs +++ b/src/Geocoding/ReverseGeocodeResource.cs @@ -47,7 +47,7 @@ public override string GetUrl() return Constants.BaseAPI + this.ApiEndpoint + this.Mode + - this.Query.ToString() + + this.Query.SerializeToLonLat() + ".json" + EncodeQueryString(opts); } diff --git a/src/Utils/GeoCoordinateBounds.cs b/src/Utils/GeoCoordinateBounds.cs index efcd770..e917f43 100644 --- a/src/Utils/GeoCoordinateBounds.cs +++ b/src/Utils/GeoCoordinateBounds.cs @@ -167,7 +167,7 @@ public double[] ToArray() /// Returns a string for use in a Mapbox query URL. public override string ToString() { - return string.Format("{0},{1}", this.SouthWest.ToString(), this.NorthEast.ToString()); + return string.Format("{0},{1}", this.SouthWest.SerializeToLonLat(), this.NorthEast.SerializeToLonLat()); } } } diff --git a/src/Utils/Vector2d/Vector2d.cs b/src/Utils/Vector2d/Vector2d.cs index 8bcf659..f09c685 100644 --- a/src/Utils/Vector2d/Vector2d.cs +++ b/src/Utils/Vector2d/Vector2d.cs @@ -186,6 +186,11 @@ public void Normalize() } public override string ToString() + { + return string.Format(NumberFormatInfo.InvariantInfo, "{0:F5},{1:F5}", this.x, this.y); + } + + public string SerializeToLonLat() { return string.Format(NumberFormatInfo.InvariantInfo, "{0:F5},{1:F5}", this.y, this.x); }