Hello Koders, I hope you are all doing well!
A few days ago, someone asked me :
How can we calculate a distance between two points with Kodular?
I then replied that I had made an application a year ago (with Thunkable :thunkable: , when I didn’t know Makeroid :makeroid: yet) and that I could then help him.
But I wanted to do more, I thought :
Maybe other people are wondering how to do it, so why not do a little tutorial?
That’s why, today I’ll show you How to calculate a distance between two points
In order to do this, you’ll need :
- Your brain
- Location_sensor component
- Notifier component
- Buttons
- Text boxes
- Labels
- Design imagination
So let’s begin !
- Current location :
If your Location sensor is not working (not activated), the calculation won’t work so we need to verify it.
If the Location sensor isn’t activated, it will display this notification :
You can put your departure address by yourself, or a button will give it to you :
- Arrival address :
You have to put your arrival address, its no big deal juste make sure to write it correctly !
- The calculation system
I didn’t invented the formula, I just found it on a forum (sorry I lost the link, it was 1 year ago) and tried to reproduce it with blocks. You can try to understand it if you want but it’s not necessary.
This procedure is called after a click on the button “Calculate distance”
As you can see, the arrival is an address and can’t be coordiwnates.
Let’s verify on Google Maps if I haven’t cheated !
Mmm there is a (little : 42 kilometers) difference between what Google Maps is telling me and what my app is. Why ?
Because the distance calculated with the app is linear, it doesn’t take into account all the curves, etc…
And that’s the problem with this method…
Voilà, I think that’s all !
I don’t know if this little tutorial will help you (I didn’t know how to write it).
I share you the aia of course and if you have any question, I will answer them with pleasure
Calculate_distance.aia (22.4 KB)