Unable to get most important tourist places like Google Thing to do does - api

I'm trying to find out which are the main tourist attractions in a city or country, I found this Google website called Things to Do (link) that does exactly what I want. I trying to get this data with Google Maps API, but I haven't being able to find these results anyhow.
I'm using Paris as an example because clearly first place most be Eiffel Tower and the web I mentioned says so. I'm using calling https://maps.googleapis.com/maps/api/place/textsearch/json?query=paris+point+of+interest&rankby=prominence but I don't even get Eiffel Tower in the 60 results the API returns.
Someone have some experience trying to do something similar or knows what maybe my problem?

I've been playing around with something similar and I don't think it's particularly easy to get sensible results with the Places API.
As far as I can tell the rankBy option you're using only applies to the nearbysearch endpoint. See the documentation here. However that type of search is based on specific coordinates with the radius limited to 50km. That's fine for local or specific city searches but not so much for wider regions and countries.
The point+of+interest textsearch query you're using isn't too bad but the quality of the results is mixed and seem to get worse the wider the search area you use. For example, if you use query=australia+point+of+interest the top result looks to be the Principality Stadium in Cardiff, UK.
So far the best search criteria I've found covering city and country regions is with things+to+do as part of the query instead, e.g. https://maps.googleapis.com/maps/api/place/textsearch/json?query=things+to+do+paris
The top results for that include Arc de Triomphe, Sacre Coeur, Champ de Mars, Louvre Museum and Eiffel Tower which is a bit more like what you'd expect. The textsearch endpoint doesn't have any sorting available but if you look at enough results you might be able to sort yourself based on something like the rating and user_ratings_total fields in the response.

Related

Google search history based on location

I was wondering if it was possible to grab people's google search data based on a location? Wonder if there is an API available or any way to achieve this.
So for example, I would like to see what people are searching within a city, and maybe use that to predict things like mental health, etc.

How to find the composedBy relation in dbpedia?

Look at this query:
construct {?symphony dct:composedBy <http://dbpedia.org/resource/Category:Symphonies_by_Ludwig_van_Beethoven>}
{
?symphony dct:subject <http://dbpedia.org/resource/Category:Symphonies_by_Ludwig_van_Beethoven>
}
You can run it over this endpoint:
http://dbpedia.org/sparql/
You will get results, so far so good:
I tried to get the music work for Beethoven by using the dct:subject, well ... that's no so correct, because it lists just the symphonies, there should be a relation to list all the works for Beethoven, including sonatas and strings ... do you know that property please?
Plus, I tried the subject property on some opera composers and the results were films that use the opera's opening for that composer as the theam for that movie. so we can see that the subject property is not good to get the musical works, i am looking for help to find something like composed by
here should be a relation to list all the works for Beethoven, including sonatas and strings
I don't see why that's necessarily the case; DBpedia only contains what people put into it, and that information, even if it's present in Wikipedia, isn't necessarily stored in a way that DBpedia can extract it.
It looks like you've got a reasonably good handle on how to explore DBpedia data, though, and that same kind of process can be helpful here. But if you're interested in what links to Beethoven, then you can have a look at the corresponding resources. This may have varied results.
For instance, if you look at the resource for Für Elise, you'll see there's no property directly linking it to the composer (and since those pages show properties in the reverse direction, too, there's no link from Beethoven to the piece, either). That's enough to show that DBpedia doesn't necessarily have the data you're looking for.
However, there is a property that might be useful, dct:subject dbc:Compositions_by_Ludwig_van_Beethoven. Based on that, you might be able to modify your query to use something like:
?symphony dct:subject dbc:Compositions_by_Ludwig_van_Beethoven
That's no guarantee, but this process of exploring the data looking for relevant bits is probably the best bet for finding this information.

Searching multiple labels in google CSE

I know it has been asked before: 1, 2. But I was reading the documents and saw it might be possible.
I need to add multiple refinements to the query in google custom search engine. So if I have multiple labels on my CSE, I would like to query a subset of them in a way. Say I have three labels: news, articles and stories. I would like to be able to search for a query like earth in all the pages included in news or stories.
For adding just one label, querying like this works fine: earth more:news. But no like when I add the second label.
According to google's documentation, you can use OR between multiple refinements. But It does not work for me. I'm using javascript and the RESTful APIs and yet I tried many combinations:
earth more:news more:stories
earth more:news OR more:stories
earth [more:news OR more:stories]
earth more:news,stories
Anyone has any ideas how it would work?
It seems AND and OR options are only for pagemap data and meta-tags and they don't work on directory structures and labels.

Foursquare API Categories

I must be misunderstanding categories on the foursquare API and it is driving me crazy.
When I send this:
https://api.foursquare.com/v2/venues/search?ll=44.874491,-93.328212&client_id=XXX&client_secret=XXX&v=20130327
I get all the venues as I would expect. However, if I do the categoryId for coffee shops as so:
https://api.foursquare.com/v2/venues/search?ll=44.874491,-93.328212&categoryId=4bf58dd8d48988d1e0931735&client_id=XXX&client_secret=XXX&v=20130327
I lose the closest coffee shops that originally showed up. In particular, the one I'm sitting in with address of 7101 France Ave S. This behavior has been consistently odd.
And then a second question: since Coffee Shop is a category below Food, should I not get them when I limit to Food category? If I do that:
https://api.foursquare.com/v2/venues/search?ll=44.874491,-93.328212&categoryId=4d4b7105d754a06374d81259&client_id=XXX&client_secret=XXX&v=20130327
I do not get a single coffee shop. This is driving me crazy and I know I must be missing something simple. Thanks in advance!
As specified in the Foursquare docs on venues/search, you should specify a radius parameter when using categoryId. Doing so with your search seems to return better results.
"Food" is a broad category and perhaps the results you are seeing are "better" matches for various reasons (popularity, proximity, etc.) Again, you should be specifying a radius when using categoryId. You ought to also look over the different intents available for venues/search to find out which one is best for your app! It may help if you start using this param as well.

Cities, Municipalities, or Settlements?

I'm trying to build a form that lets a user enter an address as easily as possible.
The way I had it before is you would choose a country, and then a list of provinces/states is populated, you choose one of those, and then type the name of the city.
However, I think this could be made easier. A lot of apps (ex. Facebook events) allow you to just type the name of the city, and then the country/province can be inferred, so I'm trying to build something like that.
I live in BC, Canada, so I'm starting with that. Looking on Wikipedia, there are a number of "cities" that are left out, such as Delta, which is a fairly big region over here. It should probably be included in the list, because in colloquial conversations, people usually say I live in "Delta" or something, even though it's not really a city. So maybe I should actually use municipalities which seem to be a superset of the cities.
But then we've left out places like Ladner, which is actually a sub-region of Delta, but now I'm worried I'm getting too specific?
Thoughts?
Also, this is just Canada. I have to include the United States as well. I'm not sure if the states are divided up quite the same way, how fine-grained should I go there, fellow Americans?
If you were trying to get the weather, or time, or trying to look up a location, and were presented with a form, how fine-grained would you expect it to recognize?
As an American, all I usually care about is City and State. Maybe an option to omit the city and fill in County/Region like you were talking about above would be appropriate, as not everyone lives near enough to a city to really claim to be from there. The only issue is you'd have to keep track of all of these in your database, and keep them updated. I'm not really sure how to go about that.
For the United States, check out the USPS City State File. This will never get all the common place names, but should cover most incorporated cities, townships, municipalities, etc (and a few unincorporated places as well).