Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 804
Eugene Avatar asked Oct 18 '25 05:10

Eugene


1 Answers

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.

like image 195
Elemental Avatar answered Oct 20 '25 18:10

Elemental