Support Topics Documentation Slack YouTube Blog

Development console problem

Hi,

I can’t switch to the “Rest Console” tab. The problem exists only in the “hospital” table.

AppID: 48D111AD-8D33-0886-FF2D-479DB5C9AD00

Hi Cem,

The problem is with the location column, which is declared as a GEO Point relation. I deleted the column and now REST Console opens just fine. It appears to be a regression and we will look into it. However, I encourage you to take a look at the new Geolocation support we added in Backendless. Instead of declaring a column of type GEO Point relation, consider declaring a column of type POINT. This way the data about your geo points will be stored directly in the hospitals table and not a relation to our separate geo location storage. You can read more about our new geo location here:
https://backendless.com/docs/js/data_spatial_overview.html

Regards,
Mark

Hi,

I changed the location data type to “point”. Now “Rest Console” tab is opened. I can query using the distanceOnSphere operator. But sorting by location does not work correctly.

Sorting works for “GeoPoint” data type;
whereClause = distance((myLatitude), (myLongitude), location.latitude, location.longitude ) < km(10)
shortBy = location

Sorting does not work for “Point” data type;
whereClause = distanceOnSphere(location, ‘POINT(28.99415697 41.06527643)’) <= 10000
shortBy = location

Hi, Cem.
As i understood, you’re a bit confused in understanding the concept of point and distance.
I’ll try to explain.

(1)
The POINT itself just points to the particular place on XY surface or in our case on the Earth. And therefore the question are: what should be used for sorting? longitude, latitude, both ? And what about LINESTRING or POLYGON ? In general case it cannot be solved in some one way.

(2)
So if you just ask the server: give me the points where distance between location and 'POINT(28.99415697 41.06527643)' less or equal then 10000, it will honestly return these points to you. whereClause is just a condition.

(3)
Thus we came to the second question – the distance. If you want to get the distance as one of the results, you have to say it.
In addition to new SPATIAL types we introduced the ability to use functions in properties. For such cases use parameter property.
E.g. property=DistanceOnSphere('POINT(0 0)', position) as mydst, returns you the dynamic property mydst which will contain the distance.
You also may use more then one property, just like in the HTTP standard (combine them with &).

(4)
And the last one – Sorting.
According to our example, point the dynamic name, you set above, so
sortBy = mydst