Class: CLLocation
Overview
A CLLocation object represents the location data generated by a CLLocationManager object. This object incorporates the geographical coordinates and altitude of the device’s location along with values indicating the accuracy of the measurements and when those measurements were made. In iOS, this class also reports information about the speed and heading in which the device is moving.
Instance Attribute Summary (collapse)
-
- altitude
readonly
The altitude measured in meters.
-
- coordinate
readonly
The geographical coordinate information.
-
- course
readonly
The direction in which the device is traveling.
-
- horizontalAccuracy
readonly
The radius of uncertainty for the location, measured in meters.
-
- speed
readonly
The instantaneous speed of the device in meters per second.
-
- timestamp
readonly
The time at which this location was determined.
-
- verticalAccuracy
readonly
The accuracy of the altitude value in meters.
Instance Method Summary (collapse)
-
- description
Returns the location data in a formatted text string.
-
- distanceFromLocation:
Returns the distance (in meters) from the receiver’s location to the specified location.
-
- initWithCoordinate:altitude:horizontalAccuracy:verticalAccuracy:course:speed:timestamp:
Initializes and returns a location object with the specified coordinate and course information.
-
- initWithCoordinate:altitude:horizontalAccuracy:verticalAccuracy:timestamp:
Initializes and returns a location object with the specified coordinate information.
-
- initWithLatitude:longitude:
Initializes and returns a location object with the specified latitude and longitude.
Methods inherited from NSObject
#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version
Constructor Details
This class inherits a constructor from NSObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NSObject
Instance Attribute Details
- (CLLocationDistance) altitude (readonly)
The altitude measured in meters. (read-only) Positive values indicate altitudes above sea level. Negative values indicate altitudes below sea level.
- (CLLocationCoordinate2D) coordinate (readonly)
The geographical coordinate information. (read-only) When running in the simulator, Core Location assigns a fixed set of coordinate values to this property. You must run your application on an iOS-based device to get real location values.
- (CLLocationDirection) course (readonly)
The direction in which the device is traveling. Course values are measured in degrees starting at due north and continuing clockwise around the compass. Thus, north is 0 degrees, east is 90 degrees, south is 180 degrees, and so on. Course values may not be available on all devices. A negative value indicates that the direction is invalid.
- (CLLocationAccuracy) horizontalAccuracy (readonly)
The radius of uncertainty for the location, measured in meters. (read-only) The location’s latitude and longitude identify the center of the circle, and this value indicates the radius of that circle. A negative value indicates that the location’s latitude and longitude are invalid.
- (CLLocationSpeed) speed (readonly)
The instantaneous speed of the device in meters per second. This value reflects the instantaneous speed of the device in the direction of its current heading. A negative value indicates an invalid speed. Because the actual speed can change many times between the delivery of subsequent location events, you should use this property for informational purposes only.
- (NSDate) timestamp (readonly)
The time at which this location was determined. (read-only)
- (CLLocationAccuracy) verticalAccuracy (readonly)
The accuracy of the altitude value in meters. (read-only) The value in the altitude property could be plus or minus the value indicated by this property. A negative value indicates that the altitude value is invalid.Determining the vertical accuracy requires a device with GPS capabilities. Thus, on some earlier iOS-based devices, this property always contains a negative value.
Instance Method Details
- (String) description
Returns the location data in a formatted text string. The returned string is intended for display purposes only.
- (CLLocationDistance) distanceFromLocation(location)
Returns the distance (in meters) from the receiver’s location to the specified location. This method measures the distance between the two locations by tracing a line between them that follows the curvature of the Earth. The resulting arc is a smooth curve and does not take into account specific altitude changes between the two locations.
- (Object) initWithCoordinate(coordinate, altitude:altitude, horizontalAccuracy:hAccuracy, verticalAccuracy:vAccuracy, course:course, speed:speed, timestamp:timestamp)
Initializes and returns a location object with the specified coordinate and course information. Typically, you acquire location objects from the location service, but you can use this method to create new location objects for other uses in your application.
- (Object) initWithCoordinate(coordinate, altitude:altitude, horizontalAccuracy:hAccuracy, verticalAccuracy:vAccuracy, timestamp:timestamp)
Initializes and returns a location object with the specified coordinate information. Typically, you acquire location objects from the location service, but you can use this method to create new location objects for other uses in your application.
- (Object) initWithLatitude(latitude, longitude:longitude)
Initializes and returns a location object with the specified latitude and longitude. Typically, you acquire location objects from the location service, but you can use this method to create new location objects for other uses in your application. When using this method, the other properties of the object are initialized to appropriate values. In particular, the altitude and horizontalAccuracy properties are set to 0, the verticalAccuracy property is set to -1 to indicate that the altitude value is invalid, and the timestamp property is set to the time at which the instance was initialized.