Distance between 2 places via


I would like to calculate distance between two places where user should be able to enter the from and to, where the app should show the distance between those two places. Is it possible?

Your input is highly appreciable!

Sasi Preetha

1 Like

What have you tried so far?

Will the user select their start and end points from Google Maps or some other way?

1 Like

Check this post

Its working if we pass lat and lng for from and to place via formula. ( i got that from Thunkable community too:)) Thunkable

But I would like to pass the places instead of lat and lng.

Yes Muneer, I saw that post before I post here but google map Distance Matrix API does not work for me, it says invalid api key.

I am trying Route Matrix API Playground | Geoapify where it has to be via POST.

How to do it via POST?

1 Like

In the Web API component, choose POST instead of GET. You will need to fill the required information as directed by the documentation.

In the Headers:
Content-Type = application/json

The details of your start and end location goes in the Body.

See this example


This can be done most easily using a backend like backendless or xano

They offer geoquery abilities out of the box!

You can complete this client side but you’ll eventually end up with excessive data pulls at times. Figuring out what’s close to you works well when you’re dealing with maybe 50 to 100 data points. However if you have data points all across your country for example and there’s thousands of them you’re not going to want to do it dad a pool every time. You shouldn’t

@muneer has a great example as well!

I think that using a DB is still a nicer option though can be costly. Using a DB to do these actions will return not only the closest points but can also return other information about those points so you don’t need to do a second query against the retuned spots to return information about the POI’s within your radius.

1 Like

If you have a list of lat/lon pairs, you can also do this within the app using the Haversine formula (search the forums for it). That’s what I did for my Air Quality app to allow the user to find the closest Purple Air sensor.

It’s a bit of a pain to set up but it works great and fast and doesn’t require any data pulls (if you already have the pairs data).

But it sounds like you don’t want to deal with lat/lon and prefer “places” so maybe that’s not an option.


I tried that tatiang. It’s giving correct distance. As you said its fast.

I am able to pass only one lat/lng i.e from(using location sensor) , how do I get the lat/lng of to(destination)?

Thank you Jared. This sounds tough.

Finally I found it:)

Sharing the project link:


Thanks all for your guidance.

1 Like

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