Thomas,
I wrote an API for you; just take a try if you want:
private static GeographyUnit GetGeographyUnitCore(string projectionString)
{
GeographyUnit geographyUnit = GeographyUnit.Unknown;
if (string.IsNullOrEmpty(projectionString))
{
throw new ArgumentException("Parameter is not valid.");
}
else if (projectionString.IndexOf("units=m", StringComparison.OrdinalIgnoreCase) != -1)
{
geographyUnit = GeographyUnit.Meter;
}
else if (projectionString.IndexOf("to_meter=0.3", StringComparison.OrdinalIgnoreCase) != -1)
{
geographyUnit = GeographyUnit.Feet;
}
else if (projectionString.IndexOf("to_meter=", StringComparison.OrdinalIgnoreCase) == -1)
{
geographyUnit = GeographyUnit.DecimalDegree;
}
if (geographyUnit == GeographyUnit.Unknown)
{
throw new ArgumentException("String is not correct.");
}
return geographyUnit;
}
Any more questions just feel free to let me know.
Thanks.
Yale