Why is the Foursquare API only generating results for certain coordinates? - api

I am using the Foursquare API to read JSON pages filled with the trending venues in areas. I tried generating a link as they explain to, but venues are only returned for the coordinates, 40.7, -74 – the ones they give as an example on their site. This can be seen using their API Explorer:
The trending restaurants are returned for the coordinates they give as an example, as can be seen at this link: https://developer.foursquare.com/docs/explore#req=venues/trending%3Fll%3D40.7,-74
But trying coordinates for San Francisco, for instance – 37.755516, -122.44812 – doesn't return anything, although it also doesn't show an error: https://developer.foursquare.com/docs/explore#req=venues/trending%3Fll%3D37.755516,-122.44812
I tried both links with my own Client ID and Client Secret outside of the explorer, but again I only got results for 40.7, -74. This leads me to believe that it must be the coordinates I'm giving it, although I cannot figure out why.
Many thanks in advance.

Not all points have trending venues nearby. If the check-in volume in the area is low, or no venues are especially busy at the moment, there will be no trending venues.
Here is a spot in San Francisco that, at the time of this writing, has trending venues: https://developer.foursquare.com/docs/explore#req=venues/trending%3Fll%3D37.786793,-122.405211
You can try increasing the "radius" parameter to capture more trending venues nearby. Here is an example of your query with a higher radius, so it captures more venues: https://developer.foursquare.com/docs/explore#req=venues/trending%3Fll%3D37.755516,-122.44812%26radius%3D20000

Related

Does TripAdvisor have pagination?

Does anyone know if TripAdvisor has pagination in any of their functions but it's undocumented? Seems bizarre to me that you wouldn't have pagination functionality built in but I don't see anything about it in their documentation?
If it's not there, how could I replicate it to get a decent spread on the returned locations?
https://www.tripadvisor.com/developers
Any help is much appreciated!
As of today, TripAdvisor API v1.0 limits all endpoints to a pretty low number of max returned items, so paging becomes pointless.
The (low) limit is different for each endpoint - all is listed in the API reference, which I cite below.
Note that their public API - used when you browse the TripAdvisor website - is https://www.tripadvisor.com/data/graphql/ids, and unsurprisingly it has an offset property for paging.
But be adivsed to not go the scraping route, as it violates their Terms of Use.
Here are the API response items limits:
Find Search
The Location Search request returns up to 10 locations found by the given
search query.
Nearby Search
The Nearby Location Search request returns up to 10 locations found
near the given latitude/longtitude.
Location Photos
The Location Photos request returns up to 2 high-quality photos for a
specific location. The photos are ordered by recency.
Location Reviews
The Location Reviews request returns up to 3 of the most recent
reviews for a specific location.
In case you're in a need for more (and you probably do), you are required to contact them, but only if the following apply (FAQ):
Once your website/app has been up and running successfully with our content for a while and you required more reviews and photos, please reach out to [...] to request more data.

Get the location of followers in Instagram

I noticed that a service called Iconosquare (and even some others) provides the location of the followers for the their platform users.
I am interested in using the Instagram API in order to get the location/age/gender (audience data) of my users' followers.
I read ALL the Instagram API documentation but there is no endpoint that can provide this kind of data.
PS : I heard about the Instagram Insight API but it's not released yet (2016/2/7).
How can they do that ?
I tried to imagine a solution :
For a specific user/token :
Get the list of followers with a public profile
Then for each follower :
Get the location of the last 10 or 20 (or even 100) posts
Create an average of latitude/longitude of that located posts
Assume that the followers come from this point (then get the name of the nearest city or country)
It's based on one major presumption about the location of the post of followers. (I imagine that i will exclude some points that are too far from the average because it might be travel posts)
I would be happy to get a feedback about doing it this way.
Thanks,

limit address search by distance

I recently joined a team working on an application that maintains listings with addresses. The user searches, and includes their zipcode, and the application displays the distance to each listing. Currently we use the Google Maps API for this. Reading through questions here on StackOverflow seem to suggest that this is the best way of doing things:
php/mysql zip code proximity search
Search engine by distance
However, while reading through the API documentation, this seems to be expressly forbidden unless we also show a map for each result (and possibly also for each result we filter out, depending on how you read the following statement):
Use of the Distance Matrix API must relate to the display of information on a Google Map; for example, to determine origin-destination pairs that fall within a specific driving time from one another, before requesting and displaying those destinations on a map. Use of the service in an application that doesn't display a Google map is prohibited.
( https://developers.google.com/maps/documentation/distancematrix/ )
What's the best way to accomplish this without running afoul of any API terms?
do you consider the Geo::PostalCode module (perl)? It uses maxmind database to calculate distances between locations (and there is bind in different languages).

What's wrong with my Twitter stream bounding boxes?

Given this url, I should see tweets around London, right?
http://stream.twitter.com/1/statuses/filter.json?locations=51.23,-0.28,51.68,0.25
But nothing happens :(
I tried different areas but I couldn't get nothing at all, although I'm trying areas given in the doc, neither using cURL / POST.
When I add a keyword track parameter, I get ton of tweets -- but it doesn't mean that location works (location bounding boxes are logical ORs w/ other filtering params).
http://stream.twitter.com/1/statuses/filter.json?track=royalwedding&locations=51.23,-0.28,51.68,0.25
Thanks !
In my experience with the Streaming API, I have found that there's a surprisingly small amount of geotagged tweets. And, it's possible your locations are too restrictive. But when you add the keyword parameter, as you state, you're getting OR'd results back for both searches -- Twitter does this so you can perform multiple streaming queries on the same connection.
If you try
http://stream.twitter.com/1/statuses/filter.json\?locations\=-180,-90,180,90
You get all sorts of responses back.
EDIT: oops, also, you have your longitude and latitude backwards. longitude comes first in their API. This URL works:
http://stream.twitter.com/1/statuses/filter.json\?locations\=-0.28,51.23,0.25,51.68

OSM API how to get all suburbs by city?

Can someone tell me how to get a list of suburbs by city (name,id,whatever) in OpenStreetMap API? I can't find any detailed documentation and the API is pretty abstract.
I'm looking at extended API, Xapi. I found how I can get nods and filter only suburbs, but I don't know how to set the city value.
http://www.informationfreeway.org/api/0.6/node[place=suburb]
Any other way or API is welcomed. Looked at geonames and google maps, but haven't found what I'm looking for. I need a list of all suburbs in Zagreb/Croatia and a way to check if a specific street is in that suburb. OSM has a pretty good and accurate data as I can see, but I'm having troubles with this API.
Have you tried setting the bounding box and then filtering the results to ensure that they are actually within Zagreb?
Here's a URL using a bounding box created on openstreetmap.org
http://open.mapquestapi.com/xapi/api/0.6/node[place=suburb][bbox=15.807,45.761,16.18,45.875]
This gives you names, but since I'm still new to OSM, I'm not quite sure how you establish their admin level and whether they actually lie within Zagreb or just within that bounding box. There may be further requests that could establish this info.
For your purposes I would use OSM Server Side Script
here is the documentation