Questions tagged [cllocationdistance]

Part of the Core Location Data Types. This is a distance measurement (in meters) from an existing location.

77 questions
0
votes
1 answer

Adding distances between coordinates in a growing array

I have an array which implements new coordinates every second into my location array. I am trying to add up the distances between each location point and carry this process on as new coordinates are implemented into the array. I want to use the…
Dan.code
  • 431
  • 2
  • 14
0
votes
2 answers

CLLocation distance tracking starts off incorrectly

I am new to Swift (and this website, so sorry if I am doing anything wrong), and I am trying to make a running app that tracks the user's location. While the function I used to track the distance works, it doesn't start at 0. When I hit the start…
Brandon
  • 23
  • 1
  • 5
0
votes
0 answers

How to display distance to a given location from current location in a tableview - Swift

Having some trouble trying to figure out the best way to go about this. I have a tableView populated with custom cells that display events that are occurring. I can display the address for each of the venues and would like to display the distance…
0
votes
2 answers

Detecting Which City User Is In

Once we request the coordinates. How do we know that the location is in New York or LA? Or neither? How do we calculate it? I have no idea how to do it. Any help please P.S.: Reverse Geocoding will convert the coordinate to name. But That is not my…
0
votes
0 answers

Swift CLLocationDistance error

I am building a learning app where i want to create pins and show the distance between current location and the pin but i get a really weird output func createPin(){ var coord = CLLocationCoordinate2D(latitude: 51.50, longitude: -0.13) …
anho
  • 1,705
  • 2
  • 20
  • 38
0
votes
1 answer

MKMapView get distance between coordinates on customized route

I have a custom route on map and want to get the distance between two coordinates on MKMapView. Below are the steps I have done so far... I have grabbed coordinate points and prepared an array of CLLocationCoordinate2D (like, customRoute =…
Srujan Simha
  • 3,637
  • 8
  • 42
  • 59
0
votes
1 answer

CLLocationDistance method not accumulating distances

I have implemented the code below to calculate total distance in gps use by adding (accumulating) all point-to-point distances using the CLLocationDistance method. I create a counter (_locManagerIteration) and in the 1st iteration I copy the first…
0
votes
2 answers

getting wrong distance for GPS coordinates

double lat1 = coordinate1.latitude * M_1_PI/180; double lat2 = coordinate2.latitude * M_1_PI/180; double lon1 = coordinate1.longitude * M_1_PI/180; double lon2 = coordinate2.longitude * M_1_PI/180; double r = 6371; double dlat = lat2 - lat1; double…
0
votes
1 answer

Center coordinate with radius convert to ne and sw coordinates

I have CLLocationCoordinate2D and some radius in meters. I would like to get two bounding coordinates (top-right and bottom-left) of the area.
Shmidt
  • 16,436
  • 18
  • 88
  • 136
0
votes
1 answer

Wrong Distance CLLocation

In this code I receive a wrong distance, _latitude and _longtitude are NSString. Any suggestion to correct this? CLLocationManager *locationManager = [[CLLocationManager alloc] init]; locationManager.desiredAccuracy =…
0
votes
2 answers

How to get the distance between my current position and a new position?

I want to get the distance between my current position and a new (current) position a few moments later. I want a timer that updates my label every second with the new distance. Example: am standing on a street with my current location and run 300…
0
votes
1 answer

Sort the nearest locations using coordinates?

I have list a of places with coordinates If users select particular location I want to suggest list of locations nearby using coordinates I can achieve that by putting loop and searching all the places within the distance from the following code …
AlgoCoder
  • 1,706
  • 5
  • 19
  • 40
0
votes
2 answers

Trouble while getting distance between two points

In my iOS app I've to track the distance from a a start point to my current location. I implemented this code: - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations { CLLocation *currentLocation =…
lucgian841
  • 1,830
  • 5
  • 34
  • 57
0
votes
1 answer

iOS MKMapView quickly redraw overlay on map

I have a triangle polygon on a MKMapView that I would like to redraw very quickly or to anchor in a specific position on the phone. This polygon will always point to the top of the phone but the map itself will spin to supplied headings. Currently…
shiznatix
  • 1,087
  • 1
  • 20
  • 37
0
votes
3 answers

Getting wrong distance between locations in iOS?

Hi aim using following method to find out the distance between my current location and the locations(lat and longitude) stored in NSMutableArray value. But am getting wrong distance..Please help.. My code -(void)getDistancetoShow:(NSMutableArray…
Bangalore
  • 1,572
  • 4
  • 20
  • 50