Use only number value or 'latitude' or 'longitude' in distance function

Hello -
I’m implementing an App which utilizes Geo Based searches. Below is my table structure.

  1. Event Table
  2. Event Location Table (with GeoPoint references)
    I wanted to search Events that are closer to User. So, i use the below whereClause.
distance( \(latitude), \(longitude), eventLocation.geoLocation.latitude, eventLocation.geoLocation.longitude ) < mi(\(radius))

When i execute the query, i get the following error message. The same query works well if i execute the query on Event Location table, looks like it fails when the relationship depth is greater than 1.

Error occured while executing getEventsMatchingSearch :- Invalid where clause: Possible to use only number value or 'latitude' or 'longitude' in distance function

Any update on this? I would like to know if this could be addressed or i should redesign my app to work around with this issue. Please advice.

Hi,

Please check what the final string of the where clause looks like. I suspect the lat and lon args are not formatted properly.

Also, you cannot use related properties for the 3rd and 4th argument in the distance function.

Mark

Hi Mark - Thanks for the response.

Here is my distance query - distance( 37.33489242, -122.03318372, eventLocation.geoLocation.latitude, eventLocation.geoLocation.longitude ) < mi(125.0)

What do you mean by related properties in 3rd and 4th argument ?

I mean that the following parameters:

eventLocation.geoLocation.latitude, eventLocation.geoLocation.longitude

will not work because they reference a related object “eventLocation”. They must reference a related GeoPoint.

Hi Mark -

Thanks for the response! In that case, would backendless support JOIN queries? Basically i have the event information in Event table and the event address is in EventLocation table. I have a reference to EventLocation in the event table and wanted to filter events by users geo location. One option i could think is to search the EventLocation first and then search the Event table based on filtered Event Location, not sure if that would be a nice approach as the user will see a spinner on the Mobile UI for a longer time. Can you please advice?

Also, would the related object search be supported anytime soon?

Thanks,
Arasan

Any update on this?

Hi Arasan,

Can you please provide an exported data from your application? You may send it to support@backendless.com mentioning this support topic.