Skip to content

Commit 53e2ba8

Browse files
committed
Update latitute and longitude Axis format
1 parent e6f1fad commit 53e2ba8

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

OxyPlot.Core.Cartography/Axes/LatitudeWebMercatorAxis.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public LatitudeWebMercatorAxis()
3030
AbsoluteMinimum = -_maxValue;
3131
AbsoluteMaximum = _maxValue;
3232
Key = "Latitude";
33-
StringFormat = "00.0###°";
33+
StringFormat = "00.0###°N;00.0###°S";
3434

3535
// Hack as 'UpdateActualMaxMin' method is internal
3636
_updateActualMaxMinMethod = typeof(Axis).GetMethod("UpdateActualMaxMin",

OxyPlot.Core.Cartography/Axes/LongitudeAxis.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public LongitudeAxis() : base()
1515
this.AbsoluteMinimum = -_maxDefaultValue;
1616
this.AbsoluteMaximum = _maxDefaultValue;
1717
Key = "Longitude";
18-
StringFormat = "00.0###°";
18+
StringFormat = "00.0###°E;00.0###°W";
1919
}
2020

2121
/// <summary>

OxyPlot.Core.Cartography/Utilities/CartographyHelper.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ public static void TileToLatLon(double x, double y, int zoom, out double latitud
9595
public static string DecimalDegreesToDegreesMinutesSeconds(double decimalDegrees, bool isLatitude, int secondsDecimal)
9696
{
9797
// see https://en.wikipedia.org/wiki/ISO_6709#Representation_at_the_human_interface_(Annex_D)
98-
var card = isLatitude ? (decimalDegrees > 0 ? "N" : "S") : (decimalDegrees > 0 ? "E" : "W");
99-
var d = Math.Truncate(decimalDegrees);
100-
var delta = Math.Abs(decimalDegrees - d);
101-
var m = Math.Truncate(60 * delta);
102-
var s = Math.Round(3600.0 * delta - 60.0 * m, secondsDecimal);
98+
char card = isLatitude ? (decimalDegrees > 0 ? 'N' : 'S') : (decimalDegrees > 0 ? 'E' : 'W');
99+
double d = Math.Truncate(decimalDegrees);
100+
double delta = Math.Abs(decimalDegrees - d);
101+
double m = Math.Truncate(60 * delta);
102+
double s = Math.Round(3600.0 * delta - 60.0 * m, secondsDecimal);
103103
return $"{Math.Abs(d):00}\u00b0{m:00}\u2032{s:00}\u2033{card}";
104104
}
105105

0 commit comments

Comments
 (0)