Restrict geocoder results to a country or city - google-geocoder

I've been using Ruby gem Geocoder version 1.3 to find coordinates of an address.
I need to restrict all results to a certain city or at least country because I'm getting most of the geolocalizations wrong.
I'm using Google for the search.
I tried for example:
Geocoder.search('Juan Cayetano Molina 450', params: { region: 'UY', components: 'country|UY'})
but I still get results in a different country. I also tried in params sending in location, country, etc. but no luck either.
I don't want to concat the city name to the search term because I'm getting as result the center of the city which is not what I wanted.
Can someone help me? Seems so simple but I couldn't find any answer that worked for me.

You can use Geocoder.search("Juan Cayetano Molina 450", params: {countrycodes: "uy"}) instead.

Related

How to get geolocation from Eircode/Post Code accurately

I am trying to get latitude and longitude from Ireland Eircode by using google API but I am not getting data from some postcodes given below:
A96X7F2
E45XD68
When I am trying to get data from this, It's returning status ZERO_RESULTS
https://maps.googleapis.com/maps/api/geocode/json?address=A96X7F2&key=API_KEY
Note: In most cases, I am getting data by using this API.
Try specifying the region:
https://maps.googleapis.com/maps/api/geocode/json?address=A96X7F2&region=ie&key=API_KEY
Issues with postcodes are discussed on their issue tracker here:
https://issuetracker.google.com/issues/73030863?pli=1
They say in that link that for best results use region or component filtering. [Both are ways to specify region, but the former is a hint, the latter is a filter.]

Google Places API for Hospitals

I am using Google Places API to search nearby hospitals from a location. My problem is that I want to get famous and big hospitals but the problem is the API is fetching clinics and even dental clinics too. How I can be more specific?
Query URL : https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=24.9044526,67.077706&type=hospital&radius=500&key=[API_KEY]
Although they are not famous even the medical facilities provided there are not sufficient for emergency case.
I have also tried increasing the radius but got same response.
I know this post is a bit old but this worked for me:
var request = {
location: location,
rankBy: google.maps.places.RankBy.DISTANCE,
type: "hospital",
keyword: "(emergency) AND ((medical centre) OR hospital) AND (24 hours)",
};
service = new google.maps.places.PlacesService(map);
service.nearbySearch(request, callback);

iOS Mapkit, identifying "type of business"

I've looked through numerous answers (most were slightly outdated), and I was wondering if Apple had some sort of way to identify the type of business it queried?
From the reference guide, MKMapItem has 5 variables, none of which tell me a place is a "Thai Restaurant" or something like that.
placemark
isCurrentLocation
name
phoneNumber
url
I think its interesting how when you do a MKMapkit query on "thai", it'll give you a list of thai restaurants but thats a one way street and no where later can I take a result from the query on "thai" to verify that it is indeed a "thai" restaurant. More importantly, what I am particularly interested in is if a business is a "Thai" restaurant and a "Bar" as well, I want to be able to do a MKMapKit query on "Bar" OR "Thai" and be able to get both of those tags
I can see a solution of getting the coordinates of a business then using Google Maps API or even Yelp API and doing a search on there to get the "type of business" but that seems extremely cumbersome and inefficient.
Thanks for any advice! One of my first questions so please so easy on me =)
First, take a look with this link : http://www.raywenderlich.com/13160/using-the-google-places-api-with-mapkit
The google API will send back the name, type, location of business location near you.
It's also send icons(via image link) of business location, so you can display it on the map, which can help you which is market, which is coffeeshop...
But the "Thai Restaurant" maybe too detail so google doesn't want to show it.
Sorry about my bad english.
Hope it help.
For that you should use google near by place search or place search api. you can pass thailand as place name and restaurant to type and it will return you all the restaurant in thailand.

Getting Location of Tweets found with Twitter Search API

Whenever I search for tweets using the geocode option, the returned tweets have "null" as their geo property. They are definitely coming from the right place because the location property has a name which is in the correct area, however I want to know what the coordinates of the tweet are so I can place on on a map (specifically Windows Phone).
I've tried a really hacky solution of searching for the location using the geo api, but this seems a really awkward way of doing it and often returns bad results (I want results from Oxford, UK but often the geo search return Oxford, IN for example).
Looking around, it seems Twitter's geolocation is currently broken, but I really need this to work for a presentation on Thursday demonstrating an app we built in a group, and it would really suck if our main feature didn't work.
Twitter's search API is broken. It will not return some information which is available through the regular API.
Once you have found a Tweet, you can try looking it up directly using statuses/show
For example, calling one of my tweets:
https://api.twitter.com/1/statuses/show.xml?id=202471009973051393&include_entities=true
gives
<geo>
<georss:point>51.52505194 -0.132582</georss:point>
</geo>
<coordinates>
<georss:point>51.52505194 -0.132582</georss:point>
</coordinates>

Find exhaustive list of restaurants around a location within a specified radius in android

I am working on an Android App. I want to get list of all restaurant around me within a specified radius(let say 5 miles). I tried using Google places API and it works, however it limits the number results returned to 20, what if there are more than 20 restaurant in that radius around me. How do I get an exhaustive list of all the restaurants? What is the best way to do this? Is there something other than Google Places API that I can use? Thanks for your help in advance.
If you want to do it server side you can use this guy's class :
http://andrenosalsky.com/blog/2011/google-places-api-php-class/
and you have to get an api key as it is explaned here :
http://code.google.com/intl/fr/apis/maps/documentation/places/
then you can send data in JSON format to your Android

Resources