Skip to content

Adding a GeoPoint

This API adds a geo point to the backend geo location storage. Once a geo point is added, it becomes searchable through all geopoint search mechanisms supported by Backendless (search in radius, search in a rectangular area, search in a category). At the present moment there are two ways to add geo points: (1) using the API documented below or (2) using the Backendless console's import function.

- (void)saveGeoPointWithGeoPoint:(GeoPoint * _Nonnull)geoPoint responseHandler:^(GeoPoint * _Nonnull)responseHandler errorHandler:^(Fault * _Nonnull)errorHandler;
func saveGeoPoint(geoPoint: GeoPoint, responseHandler: ((GeoPoint) -> Void)!, errorHandler: ((Fault) -> Void)!)


Argument                Description
geoPoint an object defining the properties of a geopoint to add.

Return Value

An instance of the GeoPoint class representing the new geopoint added to the application's geo location storage. A geopoint object contains the following properties:

Argument                Description
objectId ID assigned to geo point by Backendless when it is saved in the backend geo location storage.
latitude latitude of the point to add.
longitude longitude of the point to add.
categories an array of the geo categories the point is added to. If a category does not exist at the time when a geopoint is added, Backendless creates the category and adds the point to it. If categories are not set in the geo point, it is added to the "Default" category.
metadata the metadata associated with the geopoint.


GeoPoint *geoPoint = [[GeoPoint alloc] initWithLatitude:32.81 longitude:-96.80 categories:@[@"restaurants", @"cool_places"] metadata:@{@"description": @"Eatzi's"}];
[Backendless.shared.geo saveGeoPointWithGeoPoint:geoPoint responseHandler:^(GeoPoint *savedPoint) {
    NSLog(@"GeoPoint has been saved: %@", savedPoint);
} errorHandler:^(Fault *fault) {
    NSLog(@"Error: %@", fault.message);
let geoPoint = GeoPoint(latitude: 32.81, longitude: -96.80, categories: ["restaurants", "cool_places"], metadata: ["description": "Eatzi's"])
Backendless.shared.geo.saveGeoPoint(geoPoint: geoPoint, responseHandler: { savedPoint in
    print("GeoPoint has been saved: \(geoPoint)")
}, errorHandler: { fault in
    print("Error: \(fault.message ?? "")")