How to turn Text Address into Geographic Address

my api key however works in the search inputs

The bookmarks function in the forum is helpful at times…like when I see something I don’t need at the moment but can understand it’s value and likely future use, I will bookmark the post and label something that I could remember later.

Other approaches are to have an app that I add things I use often such as the custom CSS needed for different thinks like scrollbars. Sometimes, though it is just looking into an app I remember I had used the approach in before.

I haven’t done anything to really be very organized, but just use a combination of things that may help me in my search when it is needed. Sometimes, I am just searching the forum again for a post I read in the past.

1 Like

That is interesting. Maybe reach out to Bubble support about what might be the reason your API keys are deemed invalid for some purposes, but other purposes are not.

Hey @boston85719!

Trying to get this to work in my app and looking through the example you provided and can’t help but notice that there are no entries in the geo-address field.

Any idea what’s going on there? I’d love to get this to work!

Thanks! :slight_smile:

Screen Shot 2021-07-28 at 2.53.16 PM

Absolutely no idea why that field would not have any data. Those are data entries that I did not add, so not sure what the users who did add them were doing.

My assumption is that they did not first click the button to create the address before clicking the button to convert it to geo address. But after testing this myself it seems like Bubble has removed an ability to use the Google Maps API in a free app and this app doesn’t have Google API Keys setup.

Ahh gotcha that makes sense!

I tried clicking both buttons (I’m the Ontario one!) and it didn’t work hence the ask :slight_smile:

I thiiiiiiink I figured out how to make it work from the example anyway (although now dealing with Canadian postal codes being all mangled in Google Maps API lol)

Thanks once again @boston85719 !

Brian

If you want you could just use the coordinates of a city/town and google will output a complete geographic address…and at times it might not include a street address if you don’t want it to. I ran a backend workflow for a client to take the coordinates of Canadian cities and turn them into geographic addresses.

Interesting idea…

Presumably that would standardize any “pin” placements on a map if done that way?

ie. whatever Google uses as their standard…

It would just make it so that a city/town will be saved in your DB as s specific location based on the coordinates you provide.

I

Sorry, I mean if I got the exact “ROOFTOP” location from Google Maps ala…

…then should have pretty standard pin placements on a map.

…from Layanan Geocoding  |  Maps JavaScript API  |  Google for Developers

1 Like

First of all, congratulations to @boston85719 for the solution presented and for sharing. I racked my brains for over a month to get to almost the same solution and it was only after wasting so much time that the idea of consulting the Bubble Forum crossed my mind.

So, I’ll post here the solution that I found myself and that partly resembles @boston85719 and that I think adds an improvement regarding the control of possible commas and double spaces in the event that any of the requested address records in the operator ‘formatted as text’ is empty (ie street number = empty OR street name = empty OR city = empty OR state = empty OR ZIP code = empty OR etc…).

My workflow is in a different sequence than @boston85719 . I think in a more logical order:


OBSERVATION:
Text to find = space after comma
Replace by = Do not write anything, which corresponds to empty character. That is, the ‘find & replace’ will erase all the commas that do not make sense because they are preceded by nothing because the waiting data was empty.


NOTE:
Text to find = It’s a regex (I’m not an expert in regex, so maybe an expert can solve everything in one ‘find & replace’ or simply improve my regex…). The regex is: “^CommaSpace”.
Replace by = Do not write anything.

OBSERVATION: After I concretely tested the solution presented by @Boston85719, I noticed that the Bubble (or the Google API…) automatically completes or corrects the address based on some data (Zip Code?) so that it makes real sense as Geographic Address.

@iluminoapp awesome job on getting a working solution for your use case. Glad the post was helpful in getting you to it.

Looking at your setup I have a couple of pointers/tips that may be helpful in the future.

If there is a need to omit empty components, I don’t think you need the extract with regex and could use the ‘formatted as text’ in the first Make Changes to Retailer-Listing. In the area where you use the format as text following my approach, you could then say something like ‘result of step 1 Street address is empty format as text’ which then in the yes field, you leave it empty, but in the no field (indicates the STREET-ADDRESS is not empty) you could use the dynamic expression ‘result of step 1 STREET-ADDRESS’ followed by a static comma. This way if it is empty it is just blank, but if not you have the value with the comma after it.

I do have a question about this setup regarding the use of the ‘converted to list’ operator. It looks like you are taking a single value (result of step 1) and turning it into a list (that is the ‘converted to list’ operator). Is there a specific need in your setup to operate on it as if it is a list? My first thought would be to remove the ‘converted to list’ operator.

First of all, thank you so much for the answer @boston85719 . Your correction was just magical, thank you very much for it.

I’m still learning how to use Bubble and that’s why, even though I’ve studied a lot theoretically about the tool, it’s only by actually practicing that I can understand the importance of some operators and even realize their existence.

In this case I totally ignored the ‘is empty’ operator function and its “siblings”.

Your solution solved a lot for me and is now running almost perfectly and much better than what I had achieved with regex, which in some situations didn’t work.

I say it was ‘almost’ perfect because the ‘non-empty’ values are always followed by a comma and therefore, in the case where this value ends the address composition, I get an unnecessary comma (Example: Street name, Street number, :point_left: :point_left: :point_left:). But for now, worrying too much about it is precious.

The use of the ‘converted to list’ operator was also due to the lack of knowledge of the ‘is empty’ operator. I used the ‘converted to list’ just to get access to the ‘formatted as text’ operator. But the ‘is empty’ operator, suggested by you, not only gives me access to the ‘formatted as text’ operator, but it serves the purpose MUCH better.
Thanks again for the help!!!

One question, the ‘Converted is empty’ operator you used has been transformed by the Bubble team into the ‘is empty’ operator or is it in fact a specific operator. I ask because I can’t get access to the ‘Converted is empty’ operator and I can’t find anything about it in the Bubble documentation either, just even about ‘is empty’.

My question is also based on the fact that I can’t understand the logic behind your explanation of why you used ‘Converted is empty’. Excuse my ignorance, but it seems to me that if ‘Converted is empty’ and ‘is empty’ are the same operator (‘is empty’ = most up-to-date syntax) and therefore behave in the same way, that is, just checking if the expression is empty, your construction makes no sense. It seems to me that ‘is empty’ actually replaced ‘Converted is empty’ but with a different logic…

Sounds like you are not putting the comma into the ‘formatted as text’ operator. You should put it in the operator field where you would place the address component…that way if it is empty, there is no comma.

Converted is the name of a data type in my database…it is not an operator, the operator is ‘is empty’.

1 Like

Hi Boston. Thanks for posting ! Could I use this method to turn huge list of text addresses to georaphic ? I have text filed with more than 1000 text addresses and I have empty geographic address field. How can I turn all this text address to geographic at once ?

Need your own google api keys on your app. Check google api documentation about call limits per minute and setup your backend workflow to have an interval that will make it so you do not exceed the rate limit google might place on api calls per minute.

Thanks ! Any advise how to setup backend workflow, when a know an interval ? Never used it before )

I would set it up as a recursive backend workflow. A quick search on the forum will turn up lots of posts on the topic.

When scheduling the backend workflow recursively you can add a number of seconds to the current date/time to set an interval.

1 Like

Is this method still working for you guys? When I try to set a geo address from arbitrary text it just doesnt save. No matter if the input address is simple or very precise with post code an all.

Yes, still working I believe. Have not had an issue that I’m aware of.