views:

2430

answers:

11

Supposedly, it is possible to get this from Google Maps or some such service. (US addresses only is not good enough.)

+22  A: 

The term you're looking for is geocoding and yes Google does provide this service. http://code.google.com/apis/maps/documentation/services.html#Geocoding

Sijin
Excellent! The section "Geocoding via HTTP" seems to be what I'm looking for.
Ola Eldøy
A: 

This seems to explain how to do it with Google Maps:

http://geochalkboard.wordpress.com/2008/08/29/integrating-the-google-maps-api-geocoder-with-arcgis-server/

MusiGenesis
+2  A: 

You can have a look at the Google Maps API docs here to get a start on this:

http://code.google.com/apis/maps/documentation/services.html#Geocoding

It also seems to be something that you can do for international addresses using Live Maps also:

http://virtualearth.spaces.live.com/blog/cns!2BBC66E99FDCDB98!1588.entry

Carl
A: 

In addition to Google Maps there are available geocoding zip code, longitude, latitude databases available for download.

eulerfx
+6  A: 

If you want to do this without relying on a service, then you download the TIGER Shapefiles from the US Census.

You look up the street you're interested in, which will have several segments. Each segment will have a start address and end address, and you interpolate along the segment to find where on the segment your house number lies.

This will provide you with a lon/lat pair.

Keep in mind, however, that online services employ a great deal of address checking and correction, which you'd have to duplicate as well to get good results.

Also note that as nice as free data is, it's not perfect - the latest streets aren't in there (they might be in the data Google uses), and the streets may be off their real location by some amount due to survey inaccuracies. But for 98% of geocoding needs it works perfectly, is free, and you control everything so you're reducing dependencies in your app.

Openstreetmaps has the aim of mapping everything in the world, though they aren't quite there it's worth keeping tabs on as they provide their data under a CC license

However, many (most?) other countries are only mapped by gov't or services for which you need to pay a fee. If you don't need to geocode very much data, then using Google, Yahoo, or some of the other free worldwide mapping services may be enough.

If you have to geocode a lot of data, then you will be best served by leasing map data from a major provider, such as teleatlas.

Adam Davis
This wouldn't work (for this question; in general it sounds fine for the US), as the question already states that a solution that only works for US addresses would not be an acceptable solution.
peSHIr
That's true, but originally the question did not state this - edits made by the author within 15 minutes of the original post are not considered edits. Still, I'll update the answer.
Adam Davis
+11  A: 

In addition to the aforementioned Google geocoding web service, there is also a competing service provided by Yahoo. In a recent project where geocoding is done with user interaction, I included support for both. The reason is I have found that, especially outside the U.S., their handling of more obscure locations varies widely. Sometimes Google will have the best answer, sometimes Yahoo.

One gotcha to be aware of: if Google really thinks they don't know where your place is, they will return a 602 error indicating failure. Yahoo, on the other hand, if it can peel out a city/province/state/etc out of your bad address, will return the location of the center of that town. So you do have to pay attention to the results you get to see if they are really what you want. There are ancillary fields in some results that tell you about this: Yahoo calls this field "precision" and Google calls it "accuracy".

Tim Farley
+1  A: 

Google's terms of service will let you use their geocoding API for free if your website is in turn free for consumers to use. If not you will have to get a license for the Enterprise Maps.

Craig Wohlfeil
+1  A: 

You could also try the OpenStreetMap NameFinder, which contains open source, wiki-like street data for (potentially) the entire world. NameFinder will cease to exist at the end of august, but Nominatim is its replacement.

peSHIr
A: 

You could try the free geocoding API's available for the USC WebGIS Geocoder.

+1  A: 

You can also do this with Microsoft's MapPoint Web Services.

Here's a blog post that explains how: http://www.codestrider.com/BlogRead.aspx?b=b5e8e275-cd18-4c24-b321-0da26e01bec5

scurial
+3  A: 

Google require you to show a Google Map with their data, with a max of 25k HTTP requests per day. Useful but you have to watch usage. They do have

http://groups.google.com/group/Google-Maps-API/web/resources-non-google-geocoders

...in which I found http://www.geonames.org/ which has both a downloadable db, free web service and a commercial web service.

Richard Watson