Page 1 of 1

How to get query with geo and distance working

Posted: Thu Mar 13, 2014 7:15 am
by sowmen choudhury

I am trying to get a query working with geocode and radius but its not working the way I want it to...

I tried using the following code with no success.

var map = Appery('googlemap_52');
var GLat = map.gmap.getCenter().lat();
var GLon = map.gmap.getCenter().lng();
var geo = [GLat, GLon];

return '{"StartGeo" : {"$nearSphere" : "'+JSON.stringify(geo)+'","$maxDistanceInKilometers" : "'+JSON.stringify(value)+'"} }';

Value is just a numeric distance from local storage..

Any help would be appreciated...


How to get query with geo and distance working

Posted: Thu Mar 13, 2014 8:39 am
by Maryna Brodina

Hello!
Please check in console or show in alert what you return in where. Check if it's correct request.


How to get query with geo and distance working

Posted: Sun May 11, 2014 8:03 pm
by RobertJay

Hi Maryna,
I use the following, and it works perfectly for me. My only issue is that it appears to require miles in whole numbers like 5 - and not 5.5 as I need. If this is in fact a limitation, do you know of any workarounds?

http://screencast.com/t/0o6XQBDC7dY1


How to get query with geo and distance working

Posted: Tue May 13, 2014 12:16 am
by Yurii Orishchuk

Hi Robert.

Please provide us with information about your request.

Make screen shot from "net" tab of debuger. Where we can see URL, all request parameters and headers.

Also please make screenshot with response.

Thanks & regards.


How to get query with geo and distance working

Posted: Tue May 13, 2014 5:42 pm
by RobertJay

How to get query with geo and distance working

Posted: Tue May 13, 2014 7:18 pm
by Evgene Karachevtsev

Hello Robert,

How do you define your query service? Does it work in test mode with value like 5.5?
http://docs.appery.io/documentation/r...


How to get query with geo and distance working

Posted: Tue May 13, 2014 11:51 pm
by RobertJay

Evgene, thank you. Upon further investigation, I believe there is no problem in using decimals. What was happening in my case is that the database records reflected geographical areas that were larger in radius than the miles I was using- so that a too-small radius was not capturing any records. In any case, I believe the problem was in my not knowing about my database and not in using decimals. I'm sorry for wasting your time, but really appreciate your help.


How to get query with geo and distance working

Posted: Wed May 14, 2014 5:56 am
by Kateryna Grynko

Hi Robert,

Thank you for the update. Let us know if you need any further help.