12,254,527 members (66,868 online)
Rate this:
See more:
how to convert dd.dddddd to ddmm.mmmm/dddmm.mmmm

User Enters Lat Long in below format (dd.dddddd):
Latitude 19.025352
Longitude 72.099148
on GUI but My Other Application Accepts only
Dec Mins (ddmm.mmmm dddmm.mmmm)
1901.52112, 07205.94888 ( or 19°01.52112', 072°05.94888')

I need a logic to Convert the same for destination system.
Posted 8-Jan-13 0:06am
Edited 8-Jan-13 0:45am
v2
ridoy 8-Jan-13 6:13am

Your question isn't understandable until you explain briefly what your problem is,what do you want to do and what is your code to do that?
vijayksingh 8-Jan-13 7:16am

User Enters Lat Long in below format (dd.dddddd):
Latitude 19.025352
Longitude 72.099148
on GUI but My Other Application Accepts only
Dec Mins (ddmm.mmmm dddmm.mmmm)
1901.52112, 07205.94888 ( or 19°01.52112', 072°05.94888')

I need a logic to Convert the same for destination system
Bernhard Hiller 9-Jan-13 2:42am

Before you started that project, you actually ought to learn some basics on geography! Learn that a degree has 60 minutes, and a minute has 60 seconds. And learn the different methods for showing direction (North, East, South, West). And maybe some projections...
Now you write code which might work but you do not understand it.
vijayksingh 9-Jan-13 3:11am

I only dont know conversion rest basic things i know very well

Rate this:

## Solution 1

I don't know hat your ddmm.mmmm format is, especially , but check this:

string ConvertDoubleToSpecial(double coord)
{
int deg = (int)coord;
double min = (coord - (int)coord)*60.0;
return String.Format("{0}*{1:00.00000}'", deg, Math.Abs(min));
}
v4
Zoltán Zörgő 8-Jan-13 6:52am

Why the downvote? It is doing exactly what the OP requested for.
vijayksingh 8-Jan-13 7:51am

Its Not Working in Required Format well thanks for support.
Zoltán Zörgő 8-Jan-13 8:41am

See update
vijayksingh 9-Jan-13 0:01am

Its failing for negative coordinates like -180.xxxx its output is -180-5.xxxxxx
Please Check since i am new to lat long.
Zoltán Zörgő 9-Jan-13 1:47am

Well, can't you change as little as this one? See update...
vijayksingh 10-Jan-13 0:58am

I could have done but i thought - sign may have impact on other values.
Well Thanks for support.
lukeer 10-Apr-13 3:26am

Have a 5 for extra patience.
Zoltán Zörgő 10-Apr-13 3:42am

Thank you :)

Top Experts
Last 24hrsThis month
 F-ES Sitecore 358 CHill60 325 OriginalGriff 315 ppolymorphe 222 RyanDev 175
 OriginalGriff 2,108 CHill60 1,495 ppolymorphe 1,333 George Jonsson 1,250 Dave Kreskowiak 992