Page 3 of 5

Google places Rankby Distance

Posted: Thu Dec 04, 2014 5:47 am
by Yurii Orishchuk

Cristian,

Please give us your app public link and describe steps to reproduce this problem in your app.

Regards.


Google places Rankby Distance

Posted: Thu Dec 04, 2014 5:48 am
by Cristian Hidalgo

Google places Rankby Distance

Posted: Thu Dec 04, 2014 5:53 am
by Cristian Hidalgo

on near search page im trying to first get current position using geolocation,
storing the position to local variable (current_long ,current_lat).Then when page loads i plot the current position on map.
using slider I then try to find nearest geopoints from db/addresses/
then I would like to plot the nearest locations on the map where my current position is located...


Google places Rankby Distance

Posted: Thu Dec 04, 2014 5:55 am
by Yurii Orishchuk

Cristian,

Please specify steps to reproduce the problem. Step-by-step where we need to click to reach goal page.

Regards.


Google places Rankby Distance

Posted: Thu Dec 04, 2014 5:57 am
by Cristian Hidalgo

1 press any flag
2 click "hitta närmaste kyrka"
3.click on button "hitta närmaste kyrka"
when clicked the console gets that error...


Google places Rankby Distance

Posted: Thu Dec 04, 2014 6:02 am
by Cristian Hidalgo

then i want the markers of the nearest locations to appear on the map


Google places Rankby Distance

Posted: Thu Dec 04, 2014 6:04 am
by Yurii Orishchuk

Cristian,

Please use following JS code:

pre

var currentlat = parseFloat(localStorage.getItem("current_lat"));
var currentlong = parseFloat(localStorage.getItem("current_long"));
var slider_value = parseInt(localStorage.getItem("slider_value"));
var whereObject = {
"location" : {
"$nearSphere" : [currentlong, currentlat],
"$maxDistanceInKilometers" : slider_value
}
};
console.log("Where object is:");
console.log(whereObject);
return JSON.stringify(whereObject);

/pre

Regards.


Google places Rankby Distance

Posted: Thu Dec 04, 2014 6:05 am
by Cristian Hidalgo

ok ill try it


Google places Rankby Distance

Posted: Thu Dec 04, 2014 6:13 am
by Cristian Hidalgo

ok getting closer :) this gives me only the nearest church ,the error is gone now.
Do i connect the array to the marker on success in order to get the markers within the search radius?
This search should find the nearest within the radius right?


Google places Rankby Distance

Posted: Thu Dec 04, 2014 6:40 am
by Cristian Hidalgo

cant believe it,same error has resurfaced without me doing anything on that page :(