Google Places Autocomplete - Clarification on content locale - api

I have a question regarding the content locale of the Google Places API. In my application, we use Places Autocomplete, and when user chose the specific place, we then use Places Detail API to fetch the information
about the place. Please note, that i've not restricted the places "type" in autocomplete.
Consider this example, "Grant Hyatt Hong Kong" the places autocomplete returns the suggestion. The suggestion has the Place ID as "ChIJ7VpqmF4ABDQRi1SbdlsRfys"
Using the place detail API, https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJ7VpqmF4ABDQRi1SbdlsRfys&key=&language=en, the content has information in english and chinese.
--------------------------
"address_components" : [
{
"long_name" : "灣仔",
"short_name" : "灣仔",
"types" : [ "neighborhood", "political" ]
.................
.................
"name" : "Grand Hyatt Hong Kong",
},
--------------------------------
However, when i perform the search using Geocode API,
http://maps.google.com/maps/api/geocode/xml?address=Grand%20Hyatt%20Hong%20Kong,%20hong%20kong, i get the content completely in english. I notice that the Places ID returned in this case, is different from the Places API autocomplete service.
Clearly, the google's database has the information about this place in english. As per the places documentation, the google place API, attempts to return information in the requested locale. In this case, the google's database has the information in english locale.
Why is this difference in the case of Places API?

I can address only one part of your question. Why Geocoding API and Places API search return different results?
Geocoding API doesn't take into account any business, so the result that you get is a different object with place ID ChIJUzElmV4ABDQRyXzjJRwo3VE. This is a compound building that Geocoding API can localize and you can see this building in Map Maker:
https://mapmaker.google.com/mapmaker?gw=90&iwloc=0_0&dtab=history&cid=5898915188285078729
Places API can find a business with place ID ChIJ7VpqmF4ABDQRi1SbdlsRfys. You can see the corresponding feature with the category Hotel in Map Maker:
https://mapmaker.google.com/mapmaker?gw=90&iwloc=0_0&dtab=history&cid=3134242950202741899
Referring to translations, I believe you should raise this issue with Google data team.
Please use the "Report a problem" link on the bottom right corner of the maps.google.com as specified in:
https://support.google.com/maps/answer/162873
Hope it helps!

Related

Is there an API to get results similar to Google's "people also search for"?

I'm looking for an API that would give similar results to the Google's "people also search for" feature. So that, for instance, when I search for Stanley Kubrik, I see all the other film directors that people search for.
I know about the Freebase API but it simply provides information about the search item, not what other search items it may be related to.
There is also a TargetingIdeaSelector tool in Google AdWords API that shows related keywords, but that doesn't really range the results semantically.
Finally, there's a very simple Bing API that shows related searches (also here), but, again, it does not range information semantically.
Do you know of any API or maybe if there is something like that in Google's APIs that would show me related searches ranged semantically?
Google used to offer such API but it was decapricated a few years back. I am unsure why this was the case but my guess is because it housed no real benefit for them and likely cost a lot to maintain. most major search engines tend to not have search API's in my experience.
You could however try an make your own using a PHP and DOM Parser to parse the results from somewhere like google and export the data out as JSON.
available for download here http://simplehtmldom.sourceforge.net
This should pull out all the links from Google which you can then format out. You can parse all data and can target objects see the documentation for more
$search = $_GET['search'];
> $google_search = file_get_html('https://www.google.co.uk/?gws_rd=ssl#q=' . $search);
>
> foreach($google_search->find('a') as $item) {
> echo $item->href . '<br>';
> }
Hope that helps
The results that Google shows is based on massive amount of data that i guess built on "what X who searched for Y also searched for", "what other people similar to X who also searched for Y searched for" and so on. In addition maybe there is some reliance on semantic information coming from Freebase.
On an initiative to understand what kind of properties Google shows in their infoboxes, i.e. Why when we search for France we get a card with map, flag, capital, population ... etc. amongst the hundreds of properties relate to France i created a "Knowledge Base Extractor " that is able to parse the Google infobox and expose the data as RDF using the Fresnel Vocabulary.
The Algorithm implemented is the following:
Query DBpedia for all concepts (types) for which there is at least one instance that has a link to a Freebase ID
For each of these concepts pick (n) instances randomly
For each instance, issue a Google Search query:
if an infobox is available -> scrap the infobox to extract the properties
if no infoxbox is available, check if Google suggests "do you mean ... ?" and if so, traverse the link and look for an infobox
if no infobox or correction is available, disambiguate the concept (type) used in the search query and check if an infobox is returned
if Google suggests disambiguation in an infobox parse all the links in it -> it is best to find which suggestion maps to the current data-type we are using -> check the Freebase - DBpedia mappings
Cluster properties for each concept
I also capture that "people searched for" section, but you might also want to tweak it a bit more.
Also note that you might want to check the CSS selectors for the infobox as Google changes them often (maybe auto-generated). This is done in the options.json
"knowledgeBox" : "#kno-result",
"knowledgeBox_disambiguate" : ".kp-blk",
"property" : "._Nl",
"property_value" : ".kno-fv",
"label" : ".kno-ecr-pt",
"description" : ".kno-rdesc",
"type" : "._kx",
"images" : ".bicc",
"special_property" : ".kno-sh",
"special_property_value" : "._Zh",
"special_property_value_link" : "a._dt"

Geocoding with rails search

I've been running into some location based searches using the Google Maps API (more of a structural issue on my end than any criticism of the mapping api)
For example, if a user searches for "Victoria, Canada" it will bring up results for "Victoria, Canada" as expected. However, if a user searches for "Canada," google returns a longitude and latitude for the middle of the country, which is essential for correctly centering the map. However, it will not display any results since the nearest location is too far away from the location returned by google. I'm filtering out results that are about 20 miles away.
Can the Google Maps API return anything that I could use to tell if a user has entered a state or country name? If not, has anyone developed a work around solution?
Ideally, I would like to avoid just ordering the results by nearest location. I don't want items for "Spain" showing up at the bottom of a list when a user searches for "United States." I would try to determine if the query is a state or country prior to the search, but this seems very daunting task given the different possible spelling of country and region names. If I was only expecting english spellings, it would be a much easier approach.
Assuming this is a form on a site that has a controller parse the form and send the request to Google's API, you could break the form out into address, city, state, and country (if needed) form elements then make the address and city required fields.
I'm doing a similar approach with a site I'm building using Google Places API and it seems to work for me.

Can't I see a list of 'Others' in Foursquare herenow?

I'm writing a program looking for 'herenow' of Foursquare. As I attached, there are 2 people in the venues, but I can't see the people using the API, the API only returns an empty list.
Can't I see the members because they are with a type "others"? Isn't there any way to solve the problem?
hereNow: {count: 2,
...,
groups: [{type: "others",
...
count: 2,
items: [ ]
}
]
},
As akdotcom mentioned the documentation gives you the latest information on how the endpoint works: https://developer.foursquare.com/docs/venues/herenow
There's been a change to how this endpoint works.
It used to be that it returned everybody currently checked-in at a venue (within 3 hours).
It's been changed so if you're not checked-in at a venue you can only see your friends (and friends of friends according to the current documentation) that are checked-in there, you cannot see non-friends.
Once you check-in you'll be able to see everybody with one exception, people that have opted out of appearing in herenow will not be shown though I believe are still reflected in the count.
I believe their explanation is this is more like the real world. If you're not physically there you cannot see who's there.
Only venue managers can see everybody checked-in without being checked-in themselves.
See the endpoint documentation (https://developer.foursquare.com/docs/venues/herenow) for an overview of what "herenow" information is returned for different types of requests. You're probably making a "userless" request which only returns counts, no user information.

Google Maps Web site and API : different results

Why do calls to the Google Maps Geocoder API return different results than what I see in my browser?
This one returns many items :
http://maps.google.fr/maps?q=McDonald,+paris
This one returns a ZERO_RESULT :
http://maps.googleapis.com/maps/api/geocode/xml?McDonald,+paris&sensor=false
FAQ: https://developers.google.com/maps/faq#geocoder_differences
The API geocoder finds postal addresses. The Maps geocoder uses lots of data, including business data, to find results.
There is the Places API which can find locations based on type/class, but it may not work for business names. Documentation

Foursquare places

We would like to be able to pull out certain places from foursquare an categorize them on our website along with comments from foursquare users. I have the following questions:
1- Can we pull out places and categorize them the way we want on our website? e.g: restaurants/bar/lounge/club/landmarks/others.
2- can we pull out as well phone numbers (when available) and addresses (longitude-lattitude) of places ?
3- Does foursquare have any general descriptive summaries of each place?
Thanks for the help.
Chris
Foursquare has an API, more information can be found at this link
To answer your questions:
Yes, check out the Venues Platform in 4sq API, specifically, the search. When you query the API, as part of the result set for each venue, you get a category
If available, you will get them back under the 'contact' field, check out the response venue object from the search function
Yes, description field, you will need to make an API request to get the complete venue object.
Edit: one last thing, attribute and play nice :)
From my experience, you do not get a lot of venues with 'contact' and 'description' information. But foursquare is not very popular where I test my application, so it might be bad experience - experiment with it yourself.
FourSquare has a great category tree that you can use for categorizing restaurants
http://aboutfoursquare.com/foursquare-categories/
Actually, I'm using this tree in my website:
Dishes Map