Takis
Posts: 0
Joined: Wed Oct 22, 2014 5:10 pm

Find if a map cords are withing a cycle

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 ?

Takis
Posts: 0
Joined: Wed Oct 22, 2014 5:10 pm

Find if a map cords are withing a cycle

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?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Find if a map cords are withing a cycle

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

Takis
Posts: 0
Joined: Wed Oct 22, 2014 5:10 pm

Find if a map cords are withing a cycle

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

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Find if a map cords are withing a cycle

Hello!

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

Takis
Posts: 0
Joined: Wed Oct 22, 2014 5:10 pm

Find if a map cords are withing a cycle

Thanks

This seems to work for my case

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

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Find if a map cords are withing a cycle

Hello Panagiotis,

Thank you for the update!

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Find if a map cords are withing a cycle

Hi Panagiotis,

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

Regards.

Takis
Posts: 0
Joined: Wed Oct 22, 2014 5:10 pm

Find if a map cords are withing a cycle

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

Takis
Posts: 0
Joined: Wed Oct 22, 2014 5:10 pm

Find if a map cords are withing a cycle

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

Return to “Issues”