Possible Duplicate:
how to convert between degrees, minutes, seconds to Decimal coordinates
I have 39°07.356"N and 121°02.482"W and i need to convert it to Decimal Degrees. any source?
Possible Duplicate:
how to convert between degrees, minutes, seconds to Decimal coordinates
I have 39°07.356"N and 121°02.482"W and i need to convert it to Decimal Degrees. any source?
You can use the following function to perform the task
public decimal DmsToDD(double d, double m = 0, double s = 0)
{
return Convert.ToDecimal((d + (m/60) + (s/3600))*(d < 0 ? -1 : 1));
}
Of course, you'll need to check to make sure the minute and second components are non-negative before you do the conversion.