Skip to content

Spatial Data Delete API

There are two way to delete a spatial value from an object in the database:

  1. Using Backendless Console
  2. Using API

Deleting Data with Console

To delete a spatial value in console, simply clear out the contents of a cell and press Enter. Backendless Console confirms that the object has been updated:


Deleting Data with the API

Deleting a spatial value from an object using the API is technically the object update operation with the spatial value property set to null. The following algorithm can be used to perform deletion:

  1. Retrieve from the database the data object which contains the spatial property to be deleted.
  2. Set the property value to null.
  3. Save the object back in the database.

The example below demonstrates the approach:"Person").findFirst().then((firstPerson) {
 firstPerson["location"] = null;"Person").save(firstPerson).then((response) {
   print("location has been deleted");
Person class:
import 'package:backendless_sdk/backendless_sdk.dart';

class Person {
 Point location;
Code to delete location in a Person object:<Person>().findFirst().then((firstPerson) {
 firstPerson.location = null;<Person>().save(firstPerson).then((response) {
   print("location has been deleted");

Alternatively, the same result can be achieved using the bulk update API operation. With this approach you can delete a spatial property either in a single or multiple objects. This is done with a query (the where clause) used in the API request. For example, the following query uniquely identifies a single object: objectId = 'XXX-XXX-XXX'. Consider an example demonstrating the approach:

var whereClause = "email = ''";
var changes = {"location": null};"Person").update(whereClause, changes).then((objectsUpdated) {
 print("objectsUpdated is how many objects were updated by the API call");