Somewhat related to this question, but in the absence of any answer about QuickBooks specifically, does anyone know of an address parser for Java? Something that can take unstructured address information and parse out the address line 1, 2 and city state postal code and country?
5 Answers
I do know that the Google Maps web service is great at doing this. So, if you want to use that, you could save a lot of effort.
The real issue here is that you need a worldwide database of city/country/province names to effectively parse UNSTRUCTURED addresses.
Here is how I build a URL for use by the Google Maps API in C#:
string url = "http://maps.google.com/maps/geo?key=" + HttpUtility.UrlEncode(this.apiKey) + "&sensor=false&output=xml&oe=utf8&q=" + HttpUtility.UrlEncode(location);

- 48,783
- 32
- 145
- 190
-
10Careful with this. The Google TOS prohibits automated queries. – Dave Jarvis Sep 17 '10 at 17:05
The SourceForge JGeocoder has an address parser that you may find useful. See http://jgeocoder.sourceforge.net/parser.html.

- 219
- 4
- 6
-
Just what I was looking for. Note that it's not super robust--I passed the code just an address string (no city) and got a null pointer exception. Still, it's free and liberally licensed. – mooreds Mar 22 '11 at 18:44
Might want to read this Stack Overflow question: "Parse usable Street Address, City, State, Zip from a string". No actual Java code to do the job (just some VB), but there is some discussion of the problem and more info on the alternative John Gietzen mentions, of using a web service to interpret it for you.
The Mural project has an address parser: https://mural.dev.java.net/. I haven't figured out how to exract it from the larger Mural engine, but it does work based on some very limited tests.

- 13,518
- 7
- 42
- 51
See www.address-parser.com, they offer a web service for parsing international addresses.

- 95
- 1
- 3
-
Great find, thanks! I wish they offered a Java API (for practical reasons a web service would not work well in this scenario). – Yishai Feb 07 '10 at 21:09
-
1For a commercial product, take a look at http://www.melissadata.com. They offer a Java api which I haven't tested out. It is JNI a wrapper around their C based product. – Dave Apr 06 '10 at 14:40