Friday 1 January 2010

Convert an address to co ordinates

Hey amateur cartographers, geocachers and others interested in taking a human-readable address and turn it into a couple numbers that barely make any sense. Once you have those numbers, called latitude and longitude coordinates, you'll be able to plug them into a web map, GPS or other mapping device.

IMG:latlong_grid.png

The coordinates are similar to the Xs and Ys you used to plot in algebra class. Imagine if the surface of the Earth could be stretched flat. The horizontal axis is the equator, while the vertical axis is the Prime Meridian, which runs through the Greenwich Observatory in England.

Contents

[hide] [hide]

Convert Using a Website

There are many websites that will take an address and convert it to a point. Google Maps, for example, has to do this whenever you type a location into its search box. It, however, does not make it easy to get the latitude and longitude of the resulting location. Instead, we'll use [GetLatLon], a simple site made for this explicit purpose.

IMG:latlong_address.png

The website asks for a "place name," such as a city, but you can type in many things. You can use a postal code, an airport code, or a full address. When you click the "Zoom to place" button, the map below will update to show the location.

Even better, the text below the map will update with the coordinates you were after.

Ditch the Address, Use a Map

You can also use [GetLatLon] to find coordinates without an address. First, enter a place name to begin, or zoom in manually (which can be tedius). As in the previous section, there are many things you can type in, so use something near your location.

Next, I like to switch the map to satellite or hybrid mode by clicking the map type. That shows some non-street features.

IMG:latlong_maptype.png

Once you've switched map types, click and drag the map around, zeroing the cross-hairs (plus sign) on the spot you want. I chose home plate of a baseball diamond, something that has no address. Yet, the text below the map updates to the correct latitude and longitude of that exact point.

Get Results in XML

Are you a little more technically inclined and want a solution that's a bit more automated? You can find the latitude and longitude of an address via a URL that will send back XML. You can view the markup in a browser, or write a program to parse it for you.

Again, there are several options, but the most prominent are solutions from Google and Yahoo. In each case, you'll need an API key, which is a special code to track your usage (the services only allow a certain number of thousands of queries per day).

Since this method is a little more complicated than the others, we'll point to Webmonkey, our web developer resource, for more detail:

In The Future

Will we still need these crazy latitude and longitude points in the future? Certainly, there will always be the need to understand how to plot the locations around us. However, already we are seeing a movement toward maps that allow you to explore the world without needing to know the underlying details.

GPS is coming on more phones and other computer-like devices now. We'll soon be able to mark places we've been and share those with others. And you'll need have to know anything about latitudes and longitudes. But aren't you glad you learned anyway?

No comments:

Post a Comment

wibiya widget