Displaying Lat/Long in Decimal Minutes

We recently had a client request that we display the Latitude and Longitude of Cogo Points formatted as degrees and decimal minutes.  This format seems to have become a standard display format of many hand-held GPS units.  Unfortunately, Civil 3D does not contain a built-in option for formatting Latitude and Longitude in decimal minutes.  No problem, I thought…  I’ll simply use some expressions.  But it turned out to be a much more difficult task than I expected…  Read on for the details.

My initial thought was to create a Style that used the Latitude or Longitude truncated to the nearest degree, and combine that with an Expression that returned the decimal minutes.  Basically, the idea is something that looks like this:

decmin_label_pieces

The first part of this task was pretty easy.  I created an Expression that returned the decimal minutes, which I could format in my Style to get the desired number of decimal places.  Here’s the Expression that returns just the decimal minutes portion of the latitude:

decmin_lat_expr

The Expression for longitude is the same as the above expression, except substituting “longitude” for “latitude” in the above Expression.

However, when it came to getting the latitude or longitude truncated to the nearest degree, I ran into a problem.  It appears there is a bug in Civil 3D (well, at least in Civil 3D 2008 through the initial 2011 version, which is the current release as of this writing).  In a Civil 3D style, if we specify a precision of “degree” for a latitude or longitude, then the “Truncate” option does not work properly.  Instead of truncating the value, it applies normal rounding.  This can result in the wrong value being displayed for the degrees in our lat/long – that’s not good.

Luckily, we can work around this issue, by using another Expression as shown below:

decmin_lat_expr_trunc

And again, we need another Expression similar to the one above, for the longitude.

And now finally, we have all the Expressions we need, and we can actually create our Point and/or Table styles that use our new Expressions.  There’s only one final caveat…  We have our “truncated degrees” expression simply returning the truncated degrees in a Double, so we can’t automatically format this as a lat/long.  However, we can take care of this by adding in our direction manually in our label style.  Also, if we are in the West or South hemispheres, our latitude or longitude may be negative.  So the style is also set to drop the sign from our truncated degrees.  Here’s the result, showing how the longitude is configured in our style:

decmin_longitude_style

Now, finally, we have latitude and longitude formatted as decimal minutes!

(Note – I have posted a Civil 3D 2008 drawing that contains these expressions in the Point Labels section of the drawing settings, as well as a Point Table style using them.  Feel free to download it and examine the settings, if you desire.)

3 comments

    • Ah, that’s a cleaner solution. I hadn’t noticed the option for displaying only the “DDD part” – that’s a much better way of getting around the rounding bug than what I did.

      I searched for a previous solution to this problem, but didn’t find your earlier post in my searches. Probably because I was searching for decimal minutes (I’ve never heard the term “GPS Format”). If I had found it, it would have saved me a lot of aggravation… 🙂

  1. John Mayo says:

    Thanks Sinc. I will be needing this shortly.