Message:

Subscribe rss
Blog categories
All | Backendless features
Feature 56: Searching for geopoints in a radius
March 4, 2015 by markpiller
Spread the love

Previously I described what Backendless Geoservice is, how to populate a Backendless backend with sample data and how to run partial match geo searches. In this post I will review the API for searching geopoints in a circular shaped area, or in radius. Searching for geopoints in radius must be confined to a specific geocategory. The API will return geopoints located within specified distance (radius) from a central point, all the points will belong to the specified category. Consider the sample code below:

 Asynchronous sample (Android and Plain Java):

Synchronous sample (Plain Java only):

The program output is:

Synchronous sample:

Asynchronous sample:

Synchronous sample:

Asynchronous sample:

The code above works with the geoservice_sample category. This is a category created when you request Backendless to install sample geodata. While developing this sample I used Backendless console to verify the code results. You can perform searches in radius using the console which visualizes the geopoints located in the circular area you get to define. Below is a screenshot from my testing:search in radius - Feature 56: Searching for geopoints in a radius

To run searches in radius in console:

  1. Login to Backendless console, select your app and click the Geolocation icon.
  2. Select a geocategory where you would like to perform a search.
  3. Click the Map-driven navigation toggle located under the map.
  4. Click the Search in radius toggle.
  5. The map displays a circle which can be resized or moved – use the points on the circumference and the central one to resize and move. As you move/resize the circle, Backendless returns the geopoints located within the area and the console renders them on the map. The console also provides information about the selected radius and the coordinates of the central point.
Share this post
Tweet about this on TwitterShare on FacebookGoogle+