Earlier this year I was on the phone with a government official, asking about some of the undocumented features that came with one of his agency's databases. What came next was right out of the 'Blues Brothers' movie. It's the scene where Elwood asks a waitress, "What kind of music do you usually have here?" She replies, "Oh, we've got both kinds we've got country and western." I asked him how the agency recorded latitude and longitude. He replied, "We keep it in latitude and longitude." OK, so maybe that's funny only if you're nerdy. But you are reading Uplink. And a Tech Tip at that. I took another stab at my question: do you keep latitude and longitude in degrees or decimal degrees? The wrong answer could put a town like Halifax Estates, Fla., about 25 miles into the Atlantic Ocean. And we wouldn't want to do that to Halifax Estates. There are lots of government databases that come with latitude and longitude fields. That means there's an opportunity to map your data, and find trends you could not catch without a GIS program like MapInfo or ArcView.

Questions to ask

When you get a database like this, there are a few questions you should ask. With national databases, it should be pretty obvious whether the data is in degrees or decimal degrees. But it may be harder to tell with certain local data just by looking at it. So ask. Here's the difference: We're all used to seeing globes, where zero degrees longitude goes through Greenwich, England, making it Y2K party central. And zero degrees latitude is also known as the equator, a belt running around the middle of our planet. Every time you move a degree along the equator, you're moving about 111,320 meters. Move about 74 degrees from Greenwich, England, and you're in line with New York.

The tricky part is what happens when you're dealing with fractions of a degree. Degrees are divided into minutes and seconds. Sixty seconds makes a minute. Then sixty minutes makes a degree. Just like an hour on your watch.

But mapping programs want latitude and longitude stored in decimal degrees. That's just like it sounds.

Halifax Estates, Fla., is 80.98 decimal degrees from Greenwich, England. Go a couple hundredths more, and you're 81 decimal degrees away.

Conversions

Let's assume you have three columns of data: degrees, minutes and seconds. You want to keep degrees the same. Divide minutes by 60. That's dividing the minutes by the number needed to make a degree. Divide seconds by 3,600. That's dividing the seconds by the number needed to make a degree. In FoxPro, assuming all the fields are numeric, and longitude field is called x_long, the result would almost be a line like this: Replace all X_long with degrees + (minutes/60) + (seconds/3600). In Access, the update query would almost look like: Update MyTable set MyTable.x_long = degrees + (minutes/60) + (seconds/3600) We're almost done, but not quite. There's one more thing to do. In decimal degrees, a longitude west of Greenwich, England, in our hemisphere, is a negative number. A latitude above the equator is positive. Sometimes these are marked with a W or an N in databases. So make sure you multiply your North American longitudes by -1.

Some mapping programs come with functions that allow you to do conversions before you attempt to map a database. But running data conversions in mapping programs can be painfully slow. Here's a quick way to let your database manager do the hard work fast.

Andy Lehren works at -74.3833 longitude and 41.55 latitude and can be reached by e-mail at alehren@nbc.com.