Limit Delivery Area For Customers - Google Maps

im using google maps to save customer location in firebase. when user’s location is enabled then only it saves location coordinates to firebase. if location permission denied it doesn’t allow to save address. now,
i want to limit the area of providing service. suppose customer is in that area set by me then only he’ll be able to place orders. if customer is out of my set area orders wont be placed. Ive kml file of the area i want to serve. but i dont know how to deal with it in kodular

Save your location details as list in the variable, and calculate distance between the user location and list location and the distance is within the limit make user to proceed further if not pop up error nofiti

could you show me blocks to help me understand better @Still-learning

1 Like

I have used this block in my app. I will calculate the distance between the user location and the global location (stored manually)

Screenshot_2

My app will proceed further only if the result falls my value. If not next or submit button wont appear… :: :smirk:

1 Like

But the first thing is not how to do it in Kodular, or PHP, or Flutter, or Java, the first thing is you know what you need to do.
ALGORITHM
:slightly_smiling_face:
The distance is in radius. You define in your database so that everyone who uses your app will have the same range. OK ?
The current location is given by the Get Mylocation function, where the first return is latitude and the second is longitude. These values will be the basis for you to calculate his distance (app client) and his latitude + longitude. The result will be a distance that will be compared with your limit distance (this value will be in your database)
“I don’t know how to do it”, what did you try?
I also didn’t know, I sat down, I did the algorithm and I was searching here in the forum and in the Kodular documentation.
Even formulas to calculate distance I researched and created( sorry, I didn’t create, I generated ) an extension based on this formula. :+1:
And I did it … and you can do it too!

3 Likes

thanks @Still-learning @Rogerio_Rios
i did it finally.
:sweat_smile:
this helped me

how to round google maps like this @Rogerio_Rios

this is what my arrangement looks like

Set padding of the card view to 0

1 Like

Put inside a card view.
And Corner Radius properties = 18 Or 20.
And ALL padding =0

This one I did like this:

1 Like

thanks @AtharvaPawar @Rogerio_Rios
:upside_down_face:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.