AirBnb stlye location search with Google Places API

Hi all,

I’m trying to build a searchbox that functions similar to AirBnB’s location search.
i.e.
If a user enters the location ‘England’ a RG filters to show all results with an addrss within England
If a user enters the location ‘London’ a RG filters to show all results with an addrss within London
If a user enters a specific address a RG filters to show all results within 5kms of that address


I have a searchbox on my page with the ‘Choices Style’ of Geographic Places.

I’m using the constraint: Address is within 5kms of SearchBox Location’s Value’s Formatted Address

The issue is, if someone inputs ‘England’ for example, or a town like ‘London’, the Geographic address from Google Places API is (I believe) a single location in England. So anything outside 5kms of that exact location won’t show in the results.

Is this possible?

Bumping

Have a look at : Extract on the address.

So England won’t have a City or County so you can probably put some conditionals around what parts of the address are available.

Hi Nigel,

Thanks so much for the reply.
I did have a brief look at the :extract tool, but I had thought that with the Google Places API, when you search ‘England’, it returns a full address (which is essentially a location in the middle of the country somewhere), which means that the returned result still contains a City.

But, having just checked in debug mode, it looks as though that isn’t true at all. So you might be right here!

I will have a go and see if I can get something working and report back.

Thank you!

This topic was automatically closed after 70 days. New replies are no longer allowed.