Reputation: 2924
I am currently trying to take some results from foursquare and i'm dealing with an issue. Ok so the code is this
$("#searchform").submit(function(event){
event.preventDefault();
if (!lat) {
navigator.geolocation.getCurrentPosition(getLocation);
} else {
getVenues();
}
});
function getLocation(location) {
lat = location.coords.latitude;
lng = location.coords.longitude;
getVenues();
}
function getVenues() {
$.ajax({
type: "GET",
url: "https://api.foursquare.com/v2/venues/explore?ll="+lat+","+lng+"&client_id=MBWN340XAQP3CYFGTMW3G2DOBNNCAXCU0UUKIATUZC2LMXCE&client_secret=SXUBHBZALTT12ZBWVWAEPC1FVCPRCW24EOD50YCHY52JEP3C&v=20130619&query="+$("#query").val()+"",
success: function(data) {
$("#venues").show();
var dataobj = data.response.groups[0].items;
$("#venues").html("");
Here you can see that i take my current location and print the results that i want. But lets say im in Athens/Greece and i want to find some results from Munich/Germany.
From the documentation of "search"
i can see an
"intent=global"
but for the explore i'm trying to put a big radius but i'm having any other result.
The only thing i change in the javascript code is the following link with the radius
"https://api.foursquare.com/v2/venues/explore?ll="+lat+","+lng+"&radius=100000&client_id=MYID&client_secret=MYSECRET&v=20130619&query="+$("#query").val()+""
And i get the same results. Am i doing anything wrong or is there anything that i missed? Thanks a lot for your time
Upvotes: 1
Views: 93
Reputation: 186
If you are in Athens, Greece, but want results in Munich, Germany, pass the latitude and longitude of Munich, Germany into your request parameters instead of your current location.
You can also use the near parameter of the /venues/explore to specific a place. I believe the radius parameter is returning the same results, because it will return the closest and most related results first (which in this case includes Athens, Greece).
Upvotes: 1