Eugene
Eugene

Reputation: 60184

Is it possible to validate a postal address with Google Locations

Is it possible to validate a postal address for its completeness? Meaning, I need to grab autocomplete values using Google Places and after a user select an address I need to validate it if it contains a house number and a postcode.

Holderlinstrasse 12, 11070, Berlin, Germany - is fine

Holderlinstrasse Berlin, Germany - is not

I haven't found any APIs to serve the purpose. I've considered regex, but this also doesn't sound like an easy way.

Any advice? Thank you!

Upvotes: 4

Views: 2371

Answers (1)

Elemental
Elemental

Reputation: 7491

This is generally considered a much more difficult task that you imagine. Legitimate street addresses are extremely hard to identify even by a human. Internationally cities have vastly different ways of expressing addresses and within special environments (like the US military and large business and government organisations) addresses may not have anything like a number, street name or territory.

This closed SO question contains a fair discussion of some possibilities but there is no 100% solution.

Upvotes: 2

Related Questions