I have latitude and longitude of a fixed location. I want to check if another location (latitude and longitude) is close enough (50-100 meters) to the fixed location. I use iPhone to get current location.
The method – distanceFromLocation: of CLLocation is exactly what you need.
distanceFromCurrentLocation = [userLocation distanceFromLocation:destinationlocation]/convertToKiloMeter;
if(distanceFromCurrentLocation < 100 && distanceFromLocation > .500)
{
NSLog(@"Yeah, this place is inside my circle");
}
else
{
NSLog(@"Oops!! its too far");
}
This finds the air distance, or we can say, straight line distance only.
Hope you are not looking for road distance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With