Documentation Index
Fetch the complete documentation index at: https://mintlify.com/radarlabs/radar-sdk-ios/llms.txt
Use this file to discover all available pages before exploring further.
RadarCoordinate represents a location coordinate, wrapping a CLLocationCoordinate2D value.
Properties
coordinate
CLLocationCoordinate2D
required
The coordinate containing latitude and longitude values.Show CLLocationCoordinate2D properties
The longitude in degrees.
Instance Methods
dictionaryValue
func dictionaryValue() -> [String: Any]
- (NSDictionary *_Nonnull)dictionaryValue;
Converts the coordinate to a dictionary representation.
Returns
A dictionary representation of the coordinate.
Example
// Access coordinates from route geometry
Radar.getDistance(
origin: origin,
destination: destination,
modes: [.car],
units: .imperial
) { (status, routes) in
if let coordinates = routes?.car?.geometry.coordinates {
for radarCoordinate in coordinates {
let coord = radarCoordinate.coordinate
print("Lat: \(coord.latitude), Lon: \(coord.longitude)")
}
}
}
// Access coordinates from polygon geometry
if let polygon = geofence.geometry as? RadarPolygonGeometry {
if let coordinates = polygon._coordinates {
for radarCoordinate in coordinates {
let coord = radarCoordinate.coordinate
print("Vertex: \(coord.latitude), \(coord.longitude)")
}
}
}
// Access coordinates from route geometry
[Radar getDistanceFromOrigin:origin
destination:destination
modes:RadarRouteModeCar
units:RadarRouteUnitsImperial
completionHandler:^(RadarStatus status, RadarRoutes * _Nullable routes) {
if (routes.car.geometry.coordinates) {
for (RadarCoordinate *radarCoordinate in routes.car.geometry.coordinates) {
CLLocationCoordinate2D coord = radarCoordinate.coordinate;
NSLog(@"Lat: %f, Lon: %f", coord.latitude, coord.longitude);
}
}
}];
// Access coordinates from polygon geometry
if ([geofence.geometry isKindOfClass:[RadarPolygonGeometry class]]) {
RadarPolygonGeometry *polygon = (RadarPolygonGeometry *)geofence.geometry;
if (polygon._coordinates) {
for (RadarCoordinate *radarCoordinate in polygon._coordinates) {
CLLocationCoordinate2D coord = radarCoordinate.coordinate;
NSLog(@"Vertex: %f, %f", coord.latitude, coord.longitude);
}
}
}
See Also