## Preparing Latitude & Longitude Data for Excel Maps

Many mapping tools (and other applications like phones and GPS units) are able to create maps directly from columns containing latitude and longitude data. To use these in Excel-based mapping tools sometimes requires you to modify or transform the data. In this article we're going to go through a number of ways that you can quickly manipulate the latitude and longitude data you already have, and show accurate, high performing maps with 10000s of points.

#### Quick(ish) background

Latitude and longitude are used to locate points on the globe as a pair of numbers. Latitude represents how far north/south the point is and longitude represents how far east/east the point is. The numbers are often expressed in degrees because the earth is approximately a sphere. Because we can travel all around the world we use 360 degrees of longitude for a full circle and 180 degrees of latitude for the half circle of north-south. To make life more interesting, we don't use 0-360 longitude and 0-180 degrees latitude though. We use -180 to 180 degrees longitude and -90 to 90 degrees latitude.

(Source: Wikipedia)

0 degrees longitude passes through the 'prime meridian' of Greenwich, in south west London, England. Points west of this are negative longitude, points east are positive. 0 degrees latitude is the equator with positive numbers representing the northern hemisphere and negative the southern hemisphere.

See https://en.wikipedia.org/wiki/Geographic_coordinate_system for more of the technical details!

#### Numeric format conversions

The most common step necessary to get existing longitude latitude data successfully into maps is to convert the the values into a format that the Excel maps can understand. Here are some of the most common conversions:

#### Converting from degrees, minutes and seconds to decimal degrees

Probably one of the most common formats for latitude and longitude is the degree format of degrees minutes seconds (DMS). For example (38.897680 , -77.03653) becomes (38° 53' 51.648" N 77° 2' 11.508" W). Degrees, minutes and seconds breaks down angles a little bit like the hands of the clock into hours, minutes and seconds (hence the name). To show these in many mapping tools such as Visual Crossing requires us to convert from DMS to decimal degress using the formula:

Decimal Degrees=degrees+minutes/60+seconds/60

Here's an example of how the values apply to New York shown in Excel:

Microsoft has created a series of macros that provide a function for performing the conversion - see https://support.microsoft.com/en-us/help/213449/how-to-convert-degrees-minutes-seconds-angles-to-or-from-decimal-angle.

#### Your data contains prefixes rather than negative and numbers (eg 38.897680N , 77.03653W)

Sometimes you will encouter latitude, longitude data such as (38.897680N , 77.03653W). The N indicates 'North of the equator' and the W indicates 'West of the prime meridian'. In these cases we need to remove the letter suffixes and replace them with negative values where appropriate. Negative values are for 'West' and 'South'. Therefore we use (38.897680 , -77.03653) as our final result. An Example Excel formula to clean up the 'W' and 'S' suffix would be:

=IF(RIGHT(B3,1)="W" or RIGHT(B3,1)="S",-A1,A1)

#### Your data contains values that aren't in the right range

As we mentioned above, most mapping tools support latitudes from -180 to 180 longitude and -90 to 90 degrees latitude. If your data is between 0 to 360 and 0 to 180 degrees, simply subtract 180 from the longitude and 90 from your latitude! Sometimes you may encounter data that goes beyond the range. For example, some latitude and longitude data may be expressed in radians rather than degrees or other differences related to the projection of the data.

#### Making sure the values have enough precision

One of the most common reported problems users have is when a map of points resembles this display:

The real map should look like this.

This problem occurs because the values don't have enough precision - typically you want at least five or six digits after the decimal point to produce an accurate business map (some highly accurate use cases may require even greater precision!) The rounding of the numbers causes the values to snap to a grid-like appearance like the first screenshot. The fix for this common problem is to review your data to ensure that you have at least 5 digits after the decimal point.

#### Final thoughts

Once you have your data in the right format with enough precision you will be able to construct high perfoming maps in many applications, If you would like to try making your own maps, trying using the VIsual Crossing Maps add-in for Excel at www.visualcrossing.com/excel-maps.

If you aren't using Excel, you can apply the same techniques and conversions to show maps in SAP Lumira and MicroStrategy business intelligence products.