Objective C / iPhone comparing 2 CLLocations /GPS coordinates help

Posted by user289503 on Stack Overflow See other posts from Stack Overflow or by user289503
Published on 2010-03-21T11:55:04Z Indexed on 2010/03/21 12:01 UTC
Read the original article Hit count: 462

Filed under:
|
|
|
|

Ok , so thanks to Claus Broch I made some progress with comparing two GPS locations. I need to be able to say "IF currentlocation IS EQUAL TO (any GPS position from a list ) THEN do something

My code at the moment is :

CLLocationCoordinate2D bonusOne; bonusOne.latitude = 37.331689; bonusOne.longitude = -122.030731;

Which is the simulators GPS location at Infinite Loop

CLLocation *loc1 = [[CLLocation alloc] initWithLatitude:bonusOne.latitude longitude:bonusOne.longitude];
double distance = [loc1 getDistanceFrom:newLocation];
if(distance <= 10000000) {

Then do something }

Any number under 10000000 and it assumes that there is no match. Any ideas ? Thanks is advance.

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about iphone