Page 4 of 4

Find if a map cords are withing a cycle

Posted: Wed Nov 05, 2014 7:54 pm
by Takis

I CAN NOT BELIEVE IT !!!!!!!

4 days trying to find why is not working and the solution is .....?

Drop geopoint column CustomerGeoPoint1 and then create a NEW geopoint column with name Location.
I tried other column names and it did not work!

Why so many hours lost ?


Find if a map cords are withing a cycle

Posted: Wed Nov 05, 2014 8:03 pm
by Takis

So the remaining question

{"$or": [{"Type": "Food"},{"Type": "Drink"}]} and {"Location": {"$nearSphere": [23.791376,38.002788], "$maxDistanceInKilometers": 1}}

works with no error, but does not return what I want.
==================================
I want to return the records where
(type is food OR Drink OR xxx OR ...)
AND
(their location is in 1 kilometer radius )
==================================

Can you help on this please?


Find if a map cords are withing a cycle

Posted: Wed Nov 05, 2014 8:37 pm
by Maryna Brodina

Please share app, DB, tell us their names and specify what service to test.


Find if a map cords are withing a cycle

Posted: Thu Nov 06, 2014 7:00 am
by Takis

The nearSphere function is working, after I renamed the column to "Location" !!!

Now I am just asking of what is the correct "where" syntax for the below
which I will construct dynamically

If I put the below in the "where" in the Test tab, of the Query Service
================================
{"Location": {"$nearSphere": [23.791376,38.002788], "$maxDistanceInKilometers": 0.5}}
================================
It retuns one record which is correct

and if i put this
================================
{"$or": [{"Type": "Food"},{"Type": "Dance"}]} and {"Location": {"$nearSphere": [23.791376,38.002788], "$maxDistanceInKilometers": 0.5}}
================================
returns 3 records, which is not correct. It returns all Food or Dance Type regardless of distance.

So the "where" clause is not correct.

I want to achieve to return only all of the type Food OR Dance, that are in 0.5 Km radius.

Thanks.

Image


Find if a map cords are withing a cycle

Posted: Thu Nov 06, 2014 7:38 pm
by Maryna Brodina

Hello!

You would need to use $and as shown here http://devcenter.appery.io/documentat...


Find if a map cords are withing a cycle

Posted: Fri Nov 07, 2014 7:19 am
by Takis

Thanks

This seems to work for my case

{ "$and": [ {"$or": [{"Type": "Food"},{"Type": "Dance"}]}, {"Location": {"$nearSphere": [23.791376,38.002788], "$maxDistanceInKilometers": 0.5}} ] }


Find if a map cords are withing a cycle

Posted: Fri Nov 07, 2014 7:25 am
by Evgene Karachevtsev

Hello Panagiotis,

Thank you for the update!


Find if a map cords are withing a cycle

Posted: Mon Nov 10, 2014 11:55 pm
by Yurii Orishchuk

Hi Panagiotis,

Thanks for this update. It could be very useful for others.

Regards.


Find if a map cords are withing a cycle

Posted: Mon Jul 20, 2020 7:56 pm
by Takis

; } } text = ""{ \""$or\"": ["" + text + ""] }""; //Added code //38.002788


Find if a map cords are withing a cycle

Posted: Mon Jul 20, 2020 7:56 pm
by Takis

; } } text = ""{ \""$or\"": ["" + text + ""] }""; text1= '{ ""Location"" : { ""$nearSphere"" : [' + localStorage.getItem(""markerLng"") + '