Cristian Hidalgo
Posts: 0
Joined: Mon Nov 03, 2014 2:38 pm

Google places Rankby Distance

I have geopoints on a db, and would need some help on how to use the rankby Distance function to list the three nearesr geopoints to my current location.
Anyone familiar with this that can give me a helping hand?

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

Google places Rankby Distance

Hello Cristian,

Please look at this tutorial:
http://devcenter.appery.io/documentat...

Cristian Hidalgo
Posts: 0
Joined: Mon Nov 03, 2014 2:38 pm

Google places Rankby Distance

yes,I looked over there.
{
"location" : {
"$nearSphere" : [48.208, 16.373],
"$maxDistanceInKilometers" : 550
}
}

but the problem I have is how to assign a value from current position into this query..
i.e

{
"location" : {
"$nearSphere" : [+currentlat+,currentlon],
"$maxDistanceInKilometers" : +slider_value
}
}

how should the exact syntax be so that i can retrieve the data .
i have a listservice ,should I add the above paramaters in the request header and then?

Cristian Hidalgo
Posts: 0
Joined: Mon Nov 03, 2014 2:38 pm

Google places Rankby Distance

and how do I plot the markers of the geolocations in the db tha are closest to my current location.
the nearsphere is a mongodb specific query but how do i achieve the rankbydisatnce using nearsphere?
confused...

Cristian Hidalgo
Posts: 0
Joined: Mon Nov 03, 2014 2:38 pm

Google places Rankby Distance

can you pls have a look att my question below.Thx.

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

Google places Rankby Distance

Cristian,

We are working on it and will get back to you withe the update.

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

Google places Rankby Distance

Hi Crisitan,

Here is how to pass actual variables into query object:

pre

{
"location" : {
"$nearSphere" : [currentlat, currentlon],
"$maxDistanceInKilometers" : slider_value
}
}

/pre

Your response will be ordered in accordance to distance to goal point.

See details here: http://devcenter.appery.io/documentat...

http://prntscr.com/5d0cjl/direct

Regards.

Cristian Hidalgo
Posts: 0
Joined: Mon Nov 03, 2014 2:38 pm

Google places Rankby Distance

Image

Get this error message

Return to “Issues”