Subscribe rss
Blog categories
All | Backendless features
Feature 101: Loading data objects with related geopoints using API
April 19, 2015 by markpiller

In my previous two posts I described:

Of course both of the operations above can also be accomplished with the API. However, in this post I am going to show how to retrieve a data object which has a related geopoint. Consider the following object:

The Address table has the location column of the GEOPOINT RELATIONSHIP type. There are three data objects in the table and one of them has a related geopoint. The geopoint is shown in the screenshot below.

Notice the geopoint’s metadata ( city: NEW YORK CITY ):geopoint-in-geolocation

An object from the Address table should be an instance of the following class. The package name is irrelevant – it can be anything, however, what’s important is the location column from the table is represented through the com.backendless.geo.GeoPoint class:

The following code retrieves Address objects using an SQL query. Additionally, the query options include a request for the related “location” property. As a result, when the server returns the Address objects, they will have the location property pre-initialized. This approach is described in greater detail in the “Loading related data objects – the ‘one-step/dynamic’ approach” article:

Asynchronous API sample: (Android and Plain Java):

Synchronous API sample (Plain Java only):

The program output is:


Share this post
Tweet about this on TwitterShare on FacebookGoogle+