You can use Location.DistanceTo from the GPS library to calculate the distance between the two points. If the list of interesting points is not too large then just calculate the distance between the marker and all points each time.
thanks Erel, there are more than 500 custom points on the map. i would like to show only markers that are in 10km vicinity of the current location.
i was thinking if i could get the northeast and southwest (bounds) from the current location, i could run a query to find out the markers within the boundary.
Start simple. It takes 5 milliseconds to calculate the distance between a point and a list of 1000 points.
B4X:
Sub Process_Globals
Private allpoints As List
End Sub
Sub Service_Create
allpoints.Initialize
For i = 1 To 1000
Dim loc As Location
loc.Initialize
loc.Latitude = Rnd(-90, 90)
loc.Longitude = Rnd(-180, 180)
allpoints.Add(loc)
Next
Dim n As Long = DateTime.Now
Dim res As List
res.Initialize
Dim loc As Location
loc.Initialize
loc.Latitude = 30
loc.Longitude = 30
For Each p As Location In allpoints
Dim dist As Double = p.DistanceTo(loc)
If dist < 10000 Then res.Add(p)
Next
Log(DateTime.Now - n)
Log(res)
End Sub