Skip to content

Adding a Geo Category

This API creates a geo category. A geo category is a logical grouping of geo points. Category name may contain the following literals: a-z, A-Z, numbers 0-9 and the underscore (_ ) character. The name must start with a literal. Category names can be inspected using Backendless Console (see the image below) or using the API call retrieving a list of categories.

Adding Categories in Console

Backendless Console supports adding a category via the graphical interface. To create a category:

  1. Login to Backendless Console and select your app/backend.
  2. Click the Geolocation icon in the menu on the left.
  3. Use the "plus" icon located above the section containing the list of categories:
    create-new-geo-cat

  4. Enter the category name in the popup and click "Save".


Adding Categories with the API
Method:

Future<GeoCategory> Backendless.geo.addCategory(String categoryName);

where:

Argument                Description
categoryName name of the category to create.

Return Value

An instance of GeoCategory representing the new category. The object contains properties with category's objectId, name and number of geo points in it:

Example

Backendless.geo.addCategory("mycategory").then((savedGeoCategory) {
  print("Category has been added: $savedGeoCategory");
});