Instagram API returning results out of the given radius - geolocation

I'm using the Instagram API and giving a longitude, latitude and radius.
Except relevant results from that location, I seem to be getting few (like 1) results from outside that radius, sometimes in a different continent.
Is it possible Instagram is returning results that they consider relevant to that geo area or something? Is that a known issue?
Example query:
42.698, 23.322
5km
And i'm using the /media/search endpoint
I tried using Apigee.com to stimulate that query but they seem to be returning partial results:
https://apigee.com/snapshot/instagram?snapId=apigee-console-snapshots-1422766800000_058d16ec-932d-4c21-ad26-354fba9abf63
(I get like 900+) results, not 14-15
Thanks..

I couldn't reproduce that behavior by using those coordinates. Can you be more specific about how you consistently get that situation?

Related

How to search for Nearby Places with both Radius and rank=distance in iOS

As per Google Places API, I cannot search for nearby places using both Radius and rank=distance filters in place. Has anyone come up with alternate ways to tackle this issue?
var urlString = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=\(coordinate.latitude),\(coordinate.longitude)&radius=\(radius)&rankby=distance&sensor=true&key=\(googleAPIKey)"
This is not possible. Instead, I used radius= to get all the nearby places and then sorted in ascending order by distance from user location using array.sorted(:by method

How can I get Only Health related Data from Google API?

I want to get only results that are related to health and for that I used below api.
https://maps.googleapis.com/maps/api/place/search/json?location=23.0225,72.5714&radius=500&types=hospital&sensor=false&key="API_KEY"
Above API gives me the results related to Health but I don't want to pass location lat long Parameter.
Actually I want to search it with "input" Param like below.
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Ahmedabad&types=hospital&radius=500&key="API_KEY"
But above give me error like below
{
"predictions" : [],
"status" : "INVALID_REQUEST"
}
How can I get this type of results?
Thanks in Advance.
The places autocomplete request from your question has several issues.
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Ahmedabad&types=hospital&radius=500&key=API_KEY
If you remove the location parameter, you should remove the radius parameter as well. It doesn't make sense without location.
hospital is not allowed value in types filter of autocomplete. If you check the documentation, you will see that the only possible values are:
geocode
address
establishment
(regions)
(cities)
Place autocomplete might return only 5 suggestions. I think you are looking for something different.
Also, be aware that radar search mentioned in the comments is now deprecated and will stop working in June 2018.
https://maps-apis.googleblog.com/2017/06/announcing-deprecation-of-place-add.html
I would suggest having a look at Places API text search. Your query with Places API text search might be
https://maps.googleapis.com/maps/api/place/textsearch/json?query=Ahmedabad&type=hospital&key=YOUR_API_KEY
The text search can return up to 60 results divided into pages of 20 results. For your particular example, I got the following output
Hope this helps!

Get random address/coordinates in a specified town

Is there any way to give Google Maps API or a similar API a town name and have it return a random address inside the town? I was hoping to be able to get the data as a JSON so I could parse it with SwiftyJSON in XCode and use it, but I can't seem to find any way to get the address in the first place. If coordinates would be easier to get, then those would work too, as long as its random and inside the town borders.
You can try to use Google Places API Web Service. It allows you to query for place information on a variety of categories, such as: establishments, prominent points of interest, geographic locations, and more. You can search for places either by proximity or a text string. A Place Search returns a list of places along with summary information about each place.
A Nearby Search lets you search for places within a specified area. You can refine your search request by supplying keywords or specifying the type of place you are searching for.
A Nearby Search request is an HTTP URL of the following form:
https://maps.googleapis.com/maps/api/place/nearbysearch/output?parameters
where output may be either xml or JSON values.
And if you want either address or coordinates, you can use Geocoding for it. Here i found a tutorial on how to use Geocoding in IOS.

Include distance in Google Places autocomplete iOS api

I am trying to implement an autocomplete box that looks like the google maps iOS app. In that app, the suggestions are sorted by distance with a label on the left showing the distance. I presume they are using the Places Autocomplete API but I can't get it to return the distance. Is there some sort of flag I can use to have the autocomplete function of Google Places return distance from device? Am I using the wrong API/function?
I am currently using the following function:
autocompleteQuery:bounds:filter:callback:
Documentation is here:
https://developers.google.com/places/ios-api/autocomplete
There's no way that you can get distance information directly in the autocomplete response.
I'd recommend performing a details request for each place in the response using lookUpPlaceID. Then you can access the coordinate field of the returned place to work out the distance.
If you do this asynchronously, you can update your UI with the autocomplete predictions when they return and then update it again with the distance once the details request completes.

Twitter Stream api filter by location AND track

I'm using the following line in order to get geolocated tweets that contain a certain keyword. (I'm using the word Madonna)
https://stream.twitter.com/1.1/statuses/filter.json?track=Madonna&locations=-180,-90,180,90
My problem is that result is not consisted by geolocated tweets that contain the keyword Madonna, but is consisted by geolocated tweets in general.
Any help on what I'm doing wrong here?
"-180,-90,180,90" - it is worldwide location;
Currently for use "AND" instead of "OR" in Twitter stream API you need make request like this: https://stream.twitter.com/1.1/statuses/filter.json?locations=-74,40,-73,41 and filtered results by "Madonna" inside your app after. Unfortunatly, I can not find another way for today;
Filtering by locations can contain:
If coordinates is empty but place is populated, the region defined in
place is checked for intersection against the locations bounding box.
Any overlap will match.
Another, somewhat hack-y solution to this, is you can have a track key work that would never match, such as "dkghaskldfnascjkawenaf", and add a location bounding box.
The API does an OR relationship between tracking and location, you'll only receive tweets from within (or very nearby) the bounding box

Resources