1

Right now in my app, users can post images and it saves the user's current location with the image. In the table view i want it to query for images that are 5-10 km away from the user's area. Also users have their geolocation saved in their profile.

I know there is this code:

 query.whereKey("location", nearGeoPoint: usergeo, withinKilometers: limitlocation)

but that is within x miles, i want x miles away.

user42541
  • 69
  • 6

1 Answers1

1

I don't think there is anything in Parse's SDK that does this. You'll have to manually calculate a series of geoPoints that are 5 to 10 miles away and use them as your geoPoint values for the nearGeoPoint query.

I may have misunderstood you - do you just want to figure out how far away the geoPoints are from the user? You'll have to manually calculate that too...

Here is a link for determining distance to CLLocations, which you can create from geoPoints: Calculate distance between two place using latitude-longitude in gmap for iPhone

Edit: I forgot that you asked how to do this in swift, not objective-c: iOS: (Swift) How to show distance from current location and exist annotation on annotation subtitle

Community
  • 1
  • 1
Michael E
  • 656
  • 2
  • 7
  • 13