The Backendless GeoService covers all issues concerning locating points of interest in a geographic area. A point of interest (also referred as “geopoint”) can be defined as a pair of coordinates – latitude and longitude. Points can be added either with the API or using the import function in Backendless Console. A geopoint may have metadata associated with it, a collection of arbitrary key/value data pairs.
The metadata is searchable using the standard SQL-92 query language. Finally, a geopoint may belong to one or more categories, which is a simple grouping mechanism.
For example, a geopoint with coordinates 32.961456 and -96.82454 (which is an excellent pizzeria), may belong to the “Restaurants” category and have the following metadata:
[table “” not found /]
The diagram below visualizes the relationships between the concepts of “category”, “geopoint” and “metadata”:
There are two types of geosearch supported by GeoService. One can return geopoints within the specified radius from a set of coordinates and another searches for geopoints in a rectangular area (also identified by two pairs of coordinates).
Search in radius:
Search in a rectangular area:
Either way you search for geopoints, you can narrow down the search results by searching within specific categories and/or using a query which references geopoint metadata.
A search with a query can be very powerful. A query is the “where” clause of an SQL-92 expression. It can reference geo point’s metadata keys to narrow down search criteria.
For instance, for the metadata of our favorite pizzeria described above, the following query could find other similar places:
“Price = ‘$$’ AND Cuisine = ‘Pizza’”
When searching with a query, Backendless finds all the geopoints whose metadata precisely matches the condition of the query. Alternatively, you may need to search for geopoints with only partial metadata matches. Backendless supports it with the “relative match” search option. Relative match search request must include the metadata properties to search for as well as the percentage match threshold. For instance, if your query includes 10 key/value metadata pairs and the 50% threshold, Backendless will find all the geopoints whose metadata matches the query for at least 50%.
All geoqueries support data paging. If your application has a lot of geopoints, you can easily optimize the performance of the client side by working with the paging parameters and load only the right amount of data.
Populating a Backendless application with geopoints, the categories they belong to and any attached metadata can be done either with the API or using the import function of Backendless console. The import feature in console supports bulk import and allows importing virtually unlimited number of geopoints.