1

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?

3
  • 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, 2013 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, 2014 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, 2014 at 20:28

2 Answers 2

4

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,

0
1

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'

1
  • I've expanded this to include the math for the specific question asked
    – Martin F
    Apr 17, 2014 at 18:50

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