How to search by distance using where clause

I want to search a table that has a Point Column. I want results within x miles radius from my searching position.
I saw the example below, but GeoPoint is deprecated. And I don’t understand what “coordinates.latitude,coordinates.longitude” represents

String whereClause = "distance( 30.26715, -97.74306, " +
“coordinates.latitude, coordinates.longitude ) < mi(200)”;
DataQueryBuilder queryBuilder = DataQueryBuilder.create();
queryBuilder.setWhereClause( whereClause ).setRelationsDepth( 1 );
List friends = Backendless.Data.of( “Friend” ).find( queryBuilder );

String format = “%s lives at %f, %f tagged as ‘%s’”;

for( Map friend : friends )
GeoPoint coordinates = (GeoPoint) friend.get( “coordinates” );
Log.i( “MYAPP”, String.format( format, friend.get( “name” ),
(String) coordinates.getMetadata( “description” ) ) );

Hello @Nkekere_Tommy_Minimann

You should use distanceOnSphere function, here is documentation for this.

distanceOnSphere(location, ‘POINT(30.26715 -97.74306)’) <= 1000

Hope this helps.

Regard, Viktor

I did this
String whereClause = distanceOnSphere(location, ‘POINT(30.26715 -97.74306)’) <= 1000

But my IDE can’t resolve distanceOnSphere Method


where clause is always a string, its value must be enclosed into quotes:

String whereClause = "distanceOnSphere(location, ‘POINT(30.26715 -97.74306)’) <= 1000"