Exclude exact addresses from geographic search

Hey - I’d like to give our users an option to input their city / state / country. Anyone have a way to do this already? The geographic search feature includes exact addresses which I’d like to omit from the result set.

For example, if my city is New York, the UI shows me a slew of very granular addresses which I’d like to omit.

Perhaps you could collect city, state, and country in other standard fields and then assign them to the Geographical Search input box.

Hope it helps,
Rick

Is there a way to enable the user to lookup cities and states separately???

Please explain your new question in more (a lot more) detail. Thanks

Thanks Rick.

As a follow-up to @kramwe’s original question - does anyone know how to enable auto-suggest for lists of cities using Google or similar? We don’t want to maintain the raw list of cities ourselves and using the default approach in Bubble includes many addresses which aren’t cities which can confuse our end users.

Yep, the question is … has anyone else modified the plugin or have the code to add a restriction to the google places API?

Place Autocomplete  |  Maps JavaScript API  |  Google for Developers.

1 Like

Hey -

So, I wrote the HTML/CSS/JS to which can be used with toolkit to enable city specific search powered by google. You can get the code here: bubble/google_maps_api_limited_to_city.html at master · number-cruncher/bubble · GitHub

The search functionality looks like this:
image

Anyone should feel free to turn this into a plugin to make it easier for others to use…

4 Likes

@emmanuel
Would it be possible to implement it on bubble ?

It would be great to do geographic search limited to only a country :slight_smile:

@neerja - is this in the bubble dev backlog?

For similar previous requests, it turns out while we cannot restrict by country, we can potentially add a location with radius parameter.

Can you expose some of google API options? For example, we’re interested in only showing cities (not address level).

We have received multiple requests for geographical search and will look into place / country / city filters for future releases.

2 Likes

I use the standard Bubble input with geographic places and pass it a US Zip Code only. When given a zip only (“10021”), It returns only “New York, NY 10021, USA”. From that result, normal Bubble functions can extract the city and state.

Just adding to the thread, don’t know if working with Zip Codes fits yours or others’ use case, but I was surprised at how well this works.

FWIW, there are many free sources on the web where you can download lists of zip codes by state, county, etc. if you want to use them as a data type to “restrict” the Zip Code input to certain areas.

@meyerhd2

I was thinking of downloading a CSV with roughly 40,000 zip codes that include data fields like city name, state and lat / long points.

I was trying to search the forum for ideas of this in practice in terms of the costs associated with loading that much data into the database.

I really have no concept of how much it costs to store data.

Bumping this thread. Would really like to capture just City, State.

Hi @kramwe, would you be able to share some details on how you got this working in your app? I’m trying to achieve the same thing but not sure how to set up like you seem to have done.

Thanks!

It’s 2022, any chance we can get a way to filter out addresses when you put in a zipcode? I don’t need an exact address. Just City State And zip and it creating multiple and unnecessary hits on the google api. Considering this is a potential cost issue would bubble reconsider this?

5 Likes