Matching Geographic addresses

More of a tip holder for myself, but in case anyone needs this.

I needed to ensure unique geographic addresses were created in the database for each item created.

Due to the way these are stored (geographic address) you cant match them directly using a constraint in a ‘Do a search for’ (that I have found at least) search as you only get the option to use the following operators:

I was reluctant to create a separate field just to store the address generated. to match on.

So what I did in my case is use ‘is within’ and then restrict the location to within 0 km of the geographic address i was checking against -

and then only create it if the count is 0

This appears to work out ok so far, but am happy to explore anyone’s else’s ideas on matching geo’s.

Stuart, thanks for sharing!
Did you test it out with an address next door, meaning does 0 km mean < .01 km? (or maybe you don’t care about addresses being that close.
Separate fields in Bubble are overrated; not nearly as big a deal as ppl think but obv no reason to create them needlessly, however what about using the slug of the address? also saves you a lookup?

I tested next door locations and appears to work ok from the tests I ran, however, if you have a block of units e.g unit1 and unit 3 at the same general location then this solution would not be ideal.

In my case this isn’t an issue, but If you were to need to be very specific then I would probably use an alternative with a separate address field an match on that.

And I think I will use one as as well, to be sure that I am not causing myself headaches for future use cases.

not sure what you mean by ‘slug’ of the address as this fields is not on its own data type.