Loading map markers based on current lat/long

Is there a way to add map markers stored in a DB based on a users location? Some kind of radius calculation. Greater than or less than Lat/long.

Thank you!

Please wait I will try to give you...

  • use a circular ringed-fence as Peter pointed out.

  • select the locations from a List based on the distance the coordinates are from the USER location by iterating over your coordinates stored in a List. Calculate the distance using Blocks or using the routine in Map Marker ( DistanceToPoint( latitude , longitude ) Compute the distance, in meters, between a Marker and a latitude , longitude point.. ) . If the distance is less than a certain criteria, add it to a sub list of coordinates you use to spawn only the runtime Markers you want.

  • Create a Polygon based on a rectangular ringed fence around your USER location and iterate over your coordinates List to create a sub list of only those coordinates that fall within the created Polygon. Use DistanceToPoint( latitude , longitude , centroid ) Computes the distance between the Polygon and the given latitude and longitude . If centroids is true , the distance is computed from the center of the Polygon to the given point. Otherwise, the distance is computed from the closest point on the Polygon to the given point. Further, **this method will return 0 if centroids is false and the point is in the Polygon** . If an error occurs, -1 will be returned. to determine which points are in the polygon. Use the sub list to generate the runtime Markers based on which coordinates return -1 when you set centroids to false.

  • there may be other ways. What have you tried?

Exactly what you might try to develop a List of all coordinates depends on how you store the coordinates in your TinyDB. Are the coordinates all in a List in the same Tag? Are coordinates stored under their own Tag?