How does iPhone do geo locating?
Since there are 3 generations of iPhone, what's the mechanism of their geo locating(WiFi, GPS, any other ways?)? I am doing iPhone development recently so I want to make a deep understanding of this.
(I want a l开发者_JAVA技巧ist of all methods of locating and a specific introduction)
Thank you
The iPhone/iPodTouch non-gps geoLocation engine is provided by Skyhook Wireless . They have driven most roads in most cities with their geoLocation vans to plot wifi points against GPS and it is primarily this data that the iPhone uses to get its fixes.
Its also interesting to note that Skyhook uses the iPhone to "self heal" its access point database. If they receive a point which is not in their database, or thought to be elsewhere they refine the data.
I've spoken to a Kate Imbach of Skyhook about this technology a few times, and I'm surprised that they don't use GPS in combination with WiFi triangulation in order to improve mapping data, but it seems this is not the case.
That said, the specific methods part of your question is a different story: the iPhone SDK abstracts all of this from you. You simply need to import the CoreLocation framework into your project, adopt the CLLocationManagerDelegate protocol
Then instantiate a Locationmanager
CLLocationManager * LM = [[CLLocationManager alloc] init];
[[self locationManager] setDelegate:self];
[[self locationManager] setDesiredAccuracy:kCLLocationAccuracyBest];
[[self locationManager] startUpdatingLocation];
You can then query your locationManager or receive updates to
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
NSLog(@"Location changed!");
}
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error{
}
That should get you going!
iPhone 3GS finds your location quickly and accurately via GPS, Wi-Fi, and cellular towers.
via http://www.apple.com/iphone/iphone-3gs/maps-compass.html
Iphone can use GPS or WIFI (using WIFI triangulation) to locate coordinates. WIFI triangulation is the same process used in html5 geolocation API, more about wifi triangulation v/s GPS ( http://arstechnica.com/old/content/2008/01/where-gps-wont-do-wifi-triangulation-might.ars )
GPS can suffer from latency in coordinates lock down in a metro or crowded area, though wifi triangulation doesnt suffer from it and is fairly accurate.
Simply put WIFI triangulation works on the principle in which a ISP or geolocator service provder will sweep a area and triangulate coordinates.
精彩评论