M M
M M

Reputation: 13

Calculating walking distances in iOS

I have a list of latitude and longitude values in a database. Based on a user’s location I need to extract the closest location from the database based on walking distances. For this purpose, I need to first get all values from the database into an array and then calculate WALKING distances to each and then return the lat/long of the shortest distance.

Note: I have no problem extracting the database values. I need help with the calculation of walking distances between 2 points.

I have so far found threads here which either show straight line distances. Is there any way to get walking distances between 2 points? If so, I would appreciate if you could point me in the right direction (link/previous question) or provide some guidance on what classes or functions to use.

Upvotes: 1

Views: 394

Answers (1)

Geet
Geet

Reputation: 2437

You can get the distance in meter using the

CLLocationDistance distance = [locationOne distanceFromLocation:locationTwo];

you can acoordingly convert it into CentiMeter or Kilometer, this may serve your purpose

Upvotes: 1

Related Questions