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

Google places Rankby Distance

Cristian,

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

Regards.

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

Google places Rankby Distance

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...

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

Google places Rankby Distance

Cristian,

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

Regards.

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

Google places Rankby Distance

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...

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

Google places Rankby Distance

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

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

Google places Rankby Distance

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.

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

Google places Rankby Distance

ok ill try it

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

Google places Rankby Distance

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?

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

Google places Rankby Distance

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

Return to “Issues”