15
Views
7
Solved
###### How can we calculate distance between two point on map in outsystems
Question

Hello,

Can anyone help me with the distance calculation on map actually I want to create a food delivery application so how can I calculate user and restaurant distance on map and How can I pin point a location on map using long. and lat.

please share an oml file for better understanding,

Solution

Yes, you are right. As per my understanding you need to use DistanceMatrix API and its a paid api. Also you should go through the billing page of this as price varies according to request to API and type of the information you are fetching from API.

regards

Hello Darshan,

If you want to calculate actual distance between two geo points (which seems required in your case), you should use Google's DistanceMatrix API. This api will return actual distance between 2 points. Its a paid API and have some usage limits.

But if you just want to calculate the distance (direct displacement between 2 points) you can use any mathematical formula for that.

https://stackoverflow.com/questions/27928/calculate-distance-between-two-latitude-longitude-points-haversine-formula

Regards

Hello @Vikas Sharma Thank you for your response. It helped

Good to hear that it helps to solve your problem. If you think you are able to get the solution for issue then please mark it as solution, so it will be help other community members to search the solution quickly.

If you face any difficulty to implement the API then let me know. You need to call this API using JS.

Regards

I wanted

1. to pin point  a location(latitude, longitude) on map and

2. want to have distance between two pin location points.

so do I need to do billing google apis to perform these tasks?

Hi Darshan,

As mentioned earlier for distance there are 2 possibilities First distance according to routes (like proper route between 2 points) for this you need to call the API. but if you just want to calculate the distance like a straight line between 2 points then you can use mathematical formula.

Regards

so you mean we can't use route distance without billing the api?

Solution

Yes, you are right. As per my understanding you need to use DistanceMatrix API and its a paid api. Also you should go through the billing page of this as price varies according to request to API and type of the information you are fetching from API.