How to get all the marker on the map to near to current location in range of 4 kms

how to get all the marker on the map to near to current location in range of 4 kms

If you want a simple approximate solution, then you can use this:

1 km in latitude - approximately 0,00898°

Calculates the distance between the markers and the check, it is less than 4 km.

Thanks for your reply actech.

I am little confused here

Let say current latitude and longitude is 53.004572726 and 10.63838378 respectively and I want this to be center and in radius of 4 km all the makers which are stored in firebase should be pinned on map

Let say if some one mark his/her location and it falls under 4km range then it should be pinned

For simplicity, we assume that the surface of the earth is a sphere (1 km latitude = 1 km longitude) and a plane. You are able to calculate the distance between two points on the plane? (

You have the latitude and longitude of two points. Calculate distance between them and compare it with 4 * 0,00898 ° = 0.03592. If the distance is less than 0.03592, the marker falls in the range of 4 km.

1 Like

Thank you once again Actech for you reply. :slightly_smiling_face: it helped me to understand in better way

i got your point that we can calculate the distance between user location and the co-ordinates stored in the firebase but in that case the search needs to compare every coordinates stored in the firebase with the user location how can i narrow down the search to reduce the time. lets say we have more than 100,000 records in the firebase and near to user location there are only 10 markers. so checking 100,000 records will waste a lot of time

here is the link of UI,00-/-/EURO--1000,00?enteredFrom=one_step_search&viewMode=MAP#/?boundingBox=53.495012%2C9.845549%2C53.643845%2C10.230071

this is what i want to achieve in my app.

1 Like

To reduce the number of markers necessary to break the squares (areas). For example, you break all the markers on the 10-100 area. After that, you must first define the area in which the target marker and then search for all markers in this region, which are not further 4 km.

Another more effective way to search with the index without a breakdown on the region.

It is necessary to arrange the order all the markers coordinates and assign them to the index. When selecting a target marker you define the index and then perform a search for markers of the index up and down. Searching stops when the list of boundaries or leaving the marker coordinates of the 4 km area.

The disadvantage of this method is that it does not allow an arbitrary target point. The target point must be in the base and have an index.

1 Like

Thank you again Actech for your help.

what i am thinking is.
when a user mark its location then it should be stored in firebase by using postcode of the area… and all the further entries of that particular postcode should store as a list in that key…

and when map is opened all the marker of that particular postcode should be loaded in the map in addition to two more postcode so that some area is covered.

if you think its a good solution. please help me to know if there is a Api or a way to have postcode via co-ordinates… Thanks again :slight_smile:

or also suggest me a way to enhance this approach further

To solve your problem better to use a ready API, such as Google Map and Geometry Library google.maps.geometry.spherical.computeDistanceBetween

But Thunkable X no easy way to exchange data between the WebViewer and App.

Hello, I have the same problem, but with cultural heritage and monuments. Did you find a solution?

I would use Backendless for your dB. It is the perfect solution for this!

Alternatively, you could run a haversine formula on all Geo points as they relate to your current GL point and then order them and display the data that way

What I’ve done in my project, which finds the nearest air quality sensor to your location, is to calculate the distance between the current location and every other location in a spreadsheet using the haversine formula. See Calculate distance travelled.

1 Like

Thanks, I will try.

Anyway I’m not able to understand the API…so, by now, I want to avoid to use them