Geo Fencing boundries

I am looking to show pages in my app based on customers lon & lat.
Customers must fall into the area below to show Los Angeles content. Does anyome know how to do it? This has got me stumped.

Is the area an official boundary, or is the area a custom boundary created by you?

If it’s an official boundary

  • Here is an api, which could help you… boundaries.io
    You could determine all of the zip codes within the boundary and have some logic like…

(If zipCode = 8374 or 5789 or 9837 or 9843,
then
do “show page 1”).

  • The api should be able to determine the area code of the position of the longitude/latitude (coordinates).
  • You would need to ask the Bubble staff if the api can be incorporated into bubble.

If it’s not an official boundary

  • I expect the logic to map out the boundary would be quite complex, unless the boundary was square. The less of a square the boundary is - the more complex the logic would be.

You probably need to be a little careful with “geofence” (particularly if you are searching).

It tends to refer to a notification based “fence” - so alert the user when they within the fence with a push notification.

I think what you want to do is define a polygon using KML and then query that. Google Fusion tables seem to be able hold KML and to be able to query it for a point.

No idea how that works in practice, but an interesting exercise. US states are freely available as KML, so you could start with a simple test using that.

1 Like

I can use (zip or post codes) or (city names) to show pages.
I could get city names from Los Angeles here.

So could I create my own data base?
Then make a workflow that uses current users geo extract city to determane if it equals city in database?

If you can do it with the address then that would certainly be easier.

Actually fairly doable from Fusion if anyone is searching in the future. Uploading KML to a Fusion table is fairly simple.

Enable Fusion API calls and get a key. Make your table public. Then you can run an API call to Fusion that passes in some SQL to select intersecting geometry (does this 1m circle at lat/long intersect with any rows on the table).

I know this was a while ago now, but how did you get on with it @mobibuilder ?

Hey @mobibuilder ,
We just released a plugin that should allow you to implement this feature easily :slightly_smiling_face: :santa:t3:

@cakeheke @mikescullion