I am using the address field with the "Add address autocomplete" checked which is great. However has anyone figured out a clever way to get the zip code for this address.
In Texas we can have zip codes/cities that can span over two or more counties. I am assuming I would need to use the lat/long that is captured when using the address auto complete, but not sure how I could us it to query another site like google?
first time here in the community so sorry in advance if I mess up on proper etiquette,
What do you mean "get the zip code for this address?" Address autocomplete already uses the Google Geocoding API, Maps JavaScript API, and Places API. Are you saying the zip code is not being populated by Google?
Sorry I said zip code but meant County like I had in the initial question. How do I get the County for an address provided by a client.
I never use the address field. So, I don't know. I always integrate Google places myself so I have full access to the Google map object.
How do you integrate with Google Places, does it have the County for the address?
I was integrating Google's API long before there was a Geolocation add-on. The Places API has a lot of information in it, including the following:
{
"long_name": "Australia",
"short_name": "AU",
"types": ["country", "political"],
},
The shortcoming with the Geolocation add-on is that the data object returned from Google's API is scoped inside of a non-static function in a final OOP class. Final classes cannot be extended. This renders the API object inaccessible to further manipulation by a developer.
The Strategy 11 developers can resolve this by adding a filter to the function, but I suppose someone would have to open a ticket and ask for a filter as a feature request.
In the meantime, to access all of Google's APIs features, it's a DIY process. You can use JavaScript or the webservice to get the full data object. See this: https://developers.google.com/maps/documentation/places/web-service/details
Please login or Register to submit your answer