Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

This question already has an answer here:

I'm trying to map the national bridge inventory, but the coordinates are stored in this 9-digit code for longitude (and 8-digits for latitude)

EXAMPLE:

Longitude is 81°5.8'
Code is 081054800

Page 9 of document found here explains:
http://www.fhwa.dot.gov/bridge/mtguide.pdf

The data can be found here:
http://www.fhwa.dot.gov/bridge/nbi/ascii.cfm

I've seen there are tools like Mimee, but I can't figure out how to run it on Ubuntu (tried to install correct libraries, etc.)

Is there maybe another way to do this?

share|improve this question

marked as duplicate by whuber May 29 '13 at 13:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
This question is not subjective at all, but it is answered directly in many threads and indirectly in dozens of others: search our site on "dd dms" for example. –  whuber May 29 '13 at 13:57
    
@whuber -- Agreed that the topic -- which is DMS to DM -- may be covered in some other Qs, but not specifically in the one you refer to. Part of the confusion is that the title of this Q was mis-worded. –  martin f Apr 17 at 18:36
    
In fact, i could not find one other question on converting from DMS to DM (that's degs and dec mins). Admittedly, i'm not the best searcher of stack exchange, and the search engine on these sites leaves much to be desired. –  martin f Apr 17 at 20:28

2 Answers 2

If you're working in Ubuntu, you could use this in a shell script:

  1. To get longitude like 81°5.8' (degree and minutes from code in d,m,s):

    tmp0=`echo 081054800 | cut -c2,3`
    tmp1=`echo 081054800 | cut -c5`
    tmp2=`echo 081054800 | cut -c6,7`
    tmp3=`echo "scale=2; $tmp2/60" | bc -l`
    echo $tmp0 $tmp1 $tmp3 | awk '{ print $1"°"$2$3"'\''" }'
    

which gives: 81°5.80'

  1. To get longitude like 81.096666667 (decimal degrees from code in d,m,s):

    tmp0=`echo 081054800 | cut -c2,3`
    tmp1=`echo 081054800 | cut -c5`
    tmp2=`echo 081054800 | cut -c6,7`
    echo "scale=10; $tmp0+(($tmp1+$tmp3)/60)" | bc -l
    

which gives: 81.09666666666666666666

you can play with the scale to get the precision you need. Also, I think you need to do a complete list at once, then use a for loop for instance.

Hope this helps,

share|improve this answer
    
+1 for a shell script solution, lol! –  whuber May 29 '13 at 13:58

I'm not sure what software you want to use or how you are handling that file, but since the Code is following XXX XX XX.XX for Degrees Minutes Seconds, respectively, you can convert manually:

Decimal Degrees = Degrees + ((Minutes / 60) + (Seconds / 3600))

Decimal Degrees = 81 + ((05 / 60) + (48.00 / 3600)) = 81.096667

To get Degrees and Decimal Minutes -- the question:

(Degrees = Degrees) and Decimal Minutes = Minutes + Seconds / 60

81° and 5 + (48 / 60) = 5.80'

share|improve this answer
    
I've expanded this to include the math for the specific question asked –  martin f Apr 17 at 18:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.