trevor1940
asked on
c#: Error Trapping
Hi,
I'm looking at ways to convert MGRS coordinates to Decimal Latitude, Longitude I've come across CoordinateSharp the Developer Guide makes use of tryParse but dosn't seem say how to trap the errors nor dose the dotnetfiddle example
I also note the output is Degree minute seconds not digital
The Developer Guide Suggests "c.FormatOptions.Coordinat eFormatTyp e = CoordinateFormatType.Degre e_Decimal_ Minutes;"
However this Errors
So how do I rewrite the above trapping errors and output to Decimal Latitude, Longitude variables?
I'm looking at ways to convert MGRS coordinates to Decimal Latitude, Longitude I've come across CoordinateSharp the Developer Guide makes use of tryParse but dosn't seem say how to trap the errors nor dose the dotnetfiddle example
I also note the output is Degree minute seconds not digital
The Developer Guide Suggests "c.FormatOptions.Coordinat
However this Errors
string mgrs = "16R CV 05774 44722";
Coordinate c;
if(Coordinate.TryParse("16R CV 05774 44722", out c))
{
c.FormatOptions.CoordinateFormatType = CoordinateFormatType.Degree_Decimal_Minutes;
Console.WriteLine(c);
}
So how do I rewrite the above trapping errors and output to Decimal Latitude, Longitude variables?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
At a short glance at the parsers, they internally only use the TryParse pattern and don't bubble up any message where it failed. So in the current state, it seems, that you cannot get that information.
But as it is on GitHub, you can add this feature if you like.
But as it is on GitHub, you can add this feature if you like.
ASKER
Thanx I find it quite odd not being able tell errors
ASKER
Open in new window
However it doesn't give any indication of what the error is In this case it's badly formatted MGRS, I've seen examples out of range where user has typed the wrong values correctly