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.

Method:

Future<GeoPoint> Backendless.geo.savePoint(GeoPoint geoPoint);

Future<GeoPoint> Backendless.geo.savePointLatLon(double latitude, double longitude, Map<String, Object> metadata, [List<String> categories]);

where:

Argument                Description
geoPoint a strongly typed object defining the properties of a geo point to add. See the class definition in the "Return Value" section.
latitude latitude of the point to add.
longitude longitude of the point to add.
categories list of categories the point is added to. If a category does not exist at the time when a point is added, Backendless creates the category and adds the point to it. For the methods without this argument, the point is added to the "Default" category.
metadata metadata associated with the geo point. Must be an arbitrary collection (map) of key/value pairs. Accepted values for this parameter are: String, Number (integer and double), and Data Service objects. Date values must be represented as number in the Unix timestamp format (number of milliseconds since January 1, 1970 at UTC). Learn more about using date in search queries for category, radius, or rectangular area search.

Return Value

An instance of the GeoPoint class representing the new geo point added to the application's geo location storage.

Example

List<String> categories = ["restaurants", "cool_places"];
Map<String, dynamic> meta = {
  "name": "Eatzi's",
};
Backendless.geo.savePointLatLon(32.81, -96.80, meta, categories).then((savedGeoPoint) {
  print("Geo point has been saved. Object ID: ${savedGeoPoint.objectId}");
});