Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Places Autocomplete Address Form with PO Boxes?

I am using the Places autocomplete on a checkout form in a cart. See Example: https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-addressform

Works great, but the issue is PO Boxes! How do you guys handle them? I am surprised they do not pop in with a zip code. I have my fields disabled since they are populated by the address you select, trying not to open them back up.

Any help would be appreciated, thank you in advance.

like image 210
Dennis Avatar asked Dec 13 '22 18:12

Dennis


2 Answers

Google places is designed for getting directions to a physical location. A PO Box is not considered a physical location that anyone (except the PO Box user) would need to visit. You may want to look at SmartyStreets' US Autocomplete Pro API which includes all PO Boxes and Secondary numbers (Apartments, etc.)

Full disclosure: I work for SmartyStreets and helped to develop the US Autocomplete Pro API.

like image 198
Bryan Amundson Avatar answered Dec 27 '22 07:12

Bryan Amundson


The google places API doesn’t have PO boxes… or private bag, community mailboxes, rural district addresses or apartment numbers. It also uses extrapolation to guest the nearest address, which may not even exist. Here is an article with examples and screenshots describing the limitations of the Google Places API https://www.addy.co.nz/faq-Google-place-autocomplete-address-forum-compared.

Google address autocomplete works well for services such as an Uber pickup or navigating to someone’s house. It doesn’t work well when you need accurate addresses for mail deliveries, installing utility services (e.g. broadband, electricity), getting information about a property (e.g. valuation, sales history, surveying, settlements) or registering a legal address (e.g. statistics/census data).

There are many alternatives available, often country-specific. Here is a New Zealand address autocomplete Web API (https://www.addy.co.nz/address-finder-and-postcode-api) and JavaScript code generator (https://www.addy.co.nz/address-validation-javascript-code-generator) to add predictive address drop-down-lists with smart autocorrect / fuzzy matching capabilities. NZ Post (https://www.nzpost.co.nz/) also provides an address finder API although prices and lookup rates vary.

like image 24
Strydom Avatar answered Dec 27 '22 07:12

Strydom