In another article, we demonstrated sample code that shows how to search for Backendless geopoints in a radius. Now we will review the API for searching for geopoints in a rectangular area. The API is very similar to the one for search in radius, except the app must define the “view port” or the rectangular area on the map where the search must occur.
Consider the example below:
Notice the code above sets the search rectangle as two pairs of coordinates. The first two numbers in the setSearchRectangle
method are the latitude and longitude coordinates of the North-West corner of the search rectangle. The other two numbers are the coordinates of the South-East corner.
Backendless Console makes it easy to identify the coordinates of the search rectangle and also provides a way to run a rectangle-based search for diagnostics purposes. To run a rectangle-based search in the Console: