YQL documentation for the google.news search and the "geo" key - geolocation

Someone know some documentation of Yql Google News Search? I am trying understand the "geo" key values for the search.
This link show a example for the search.
Thanks and sorry for my bad english.
Cleber.

For details of the usage of the different keys on the YQL google.news table, see the source API's documentation.
In this case that can be found in the Google News Search API - JSON Developer's Guide, and the geo key is described as:
This optional argument tells the News Search system to scope search results to a particular location. With this argument present, the query argument (q) becomes optional. You must supply either a city, state, province, country, or zip code as in geo=Santa%20Barbara or geo=British%20Columbia or geo=Peru or geo=93108.
It goes on to say:
When using the geo property, please note the following:
Make sure the location you supply exists within the scope of your chosen news edition. For example, if you specify geo=Quebec for the Canadian edition of Google news, you probably won't get good results.
You can't combine geo with the topic property.
Some editions of News Search don't support the geo parameter. To test if geo works with a specific edition,
Go to that edition's landing page (for example, news.google.ca)
Click Add a Section.
In the Add a Local Section box on the right side of the page, enter a search query relevant to your desired location (for example, Quebec). You should now see a Local Results pane on the edition homepage.
If the Local Results pane is populated with results, you can use the geo parameter for that region.

Related

Retrieve item, its pageview and geographical attribution in one Mediawiki API call

This is a comprehensive and complete version of the answer I've already asked a while ago at Get location with Wikimedia API. I happened to dig through all the Mediawiki API, GeoData API and Wikidata Query SPARQL Service documentation for days, publish my question on Stackoverflow and several talk boards in Wikimedia but didn't find the satisfying answer.
The question is as follows: I am trying to make use of GeoData API to perform aforementioned task - country and city attribution of geolocated item. The short description of my task: get a list of Wikipedia pages around a certain location defined with coordinates, get some page properties (page views, main image), then get the country and the city (the human readable - not the IDs) which this page item belongs to. Example description: let's imagine I have some geo coordinate near Sagrada Familia as an input. I want to receive a list of N Wikipedia pages in 1km radius around this coordinate. I want to receive number of page views and main image for each of this pages. I want for each item described on the page to be determined it is located in Barcelona, Spain. I could perform it in one Wikimedia call and N Wikibase Query Service calls but it is crucial to perform the requested in one call.
I found GeoData API very clean, simple and user friendly in retrieving various data according to geo location of the item. But there are difficulties with retrieving country/city affiliation of the item. While country can theoretically be get in a single request (also not always but only if being specified and not in name format but rather by its alphabetic designation) as the parameter of GeoData API itself, the city is possible to be get only for items which are cities by themselves. From the second hand this information does exist for every geo tagged item and is available for example through Wikibase SPARQL query service. But then I'll need to perform secondary requests to WikiData which I would have liked to avoid by all means. I managed to try all the ways round:
To call Wikimedia API (GeoData extension) from within Wikibase SPARQL request but it doesn't seem to work.
To retrieve Wikidata items around certain coordinates with Wikibase SPARQL request but then I can't get information from Wikipedia about page views.
To produce a list of pages around geo location with "generator=geosearch" and pass it to several props and pageprops of Wikimedia API calling for related Wikidata item. But then I only get the IDs of Wikidata properties, while I need human readable labels.

Twitter Advanced Search not showing results

I am trying to do a simple twitter adv search query where I want to find tweets tweeted by "#BSE_News" and that contain some word like for example "Financial". However, twitter's search doesn't show any tweet and there are tons of tweets that are tweeted by BSE_News that contain this word.
What I am doing currently -
Go to the advanced search section once I have logged into my twitter a/c
I enter "Financial" in the "This exact phrase" text box and "#BSE_News" in the "From these accounts" text box. Not sure what I am doing wrong here. Any help would be appreciated.
Thank you.
You can use Twitter's advanced search boolean operators, coupled with the advanced search operator from: to construct the following query (you can copy & paste it into Twitter's search box or type it directly there):
(financial) from:BSE_News 👀
Of course, you can also broaden or narrow your search by playing with the boolean statement in between the parenthesis using the OR, AND, -(minus for NOT) and ( ) boolean combinations. For example:
(financial OR economic OR monetary OR fiscal) from:BSE_News 👀
(financial AND 2019) from:BSE_News 👀
((financial AND PODDAR) -quarter) from:BSE_News 👀
I guess with the advanced search...some functionalities were disabled, like you don't have the sentiments section anymore

Google Auto suggestion City mismatch when using in different regions

I integrated the GoogleMaps SDK to pick Location of place by AutoSuggestion, I am using GMSAutocompleteViewController to get city suggestions, with this location for city selected I want to search for hotels in our database.
But city is getting different name in different countries. For my App need to be internationally I need to get the same results everywhere across the world. ( using the GMSAutocompleteViewController)
Some cities in India are showing differently in other parts of the world.
Eg.Mangaluru to Mangalore(old)
I tried to put the App Language and Region and to English and UK respectively and also tried to apply some filter like below.
GMSAutocompleteViewController *acController = [[GMSAutocompleteViewController alloc] init];
acController.autocompleteFilter.country #"GB"
After applying filter only that country results coming.
Any suggestions to get same type results everywhere.?
I want to get the same city results getting for the same search everywhere.
You can remove the filter for the country to get results everywhere.
Based on the documentation Place Autocomplete:
**language** — The language code, indicating in which language the results should be returned, if possible. Searches are also biased to the selected language; results in the selected language may be given a higher ranking. See the list of supported languages and their codes. Note that we often update supported languages so this list may not be exhaustive. If language is not supplied, the Place Autocomplete service will attempt to use the native language of the domain from which the request is sent.
For the same city result, unfortunately, currently you can use components to filter by country.
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.

How do I check whether a given string is a valid geographical location or not?

I have a list of strings (noun phrases) and I want to filter out all valid geographical locations from them. Most of these (unwanted location names) are country or city or state names. What would be a way to do this? Is there any open-source lookup table available which contains all country, states, cities of the world?
Example desired output:
TREC4: false, Vienna: true, Ministry: false, IBM: false, Montreal: true, Singapore: true
Unlike this post: Verify user input location string is a valid geographic location?
I have a high number of strings like these (~0.7 million) so google geolocation API is probably not an option for me.
You can use geoplanet data by Yahoo, or geonames data by geonames.org.
Here is a link to geoplanet TSV file containing 5 million geographical places of the world :
https://developer.yahoo.com/geo/geoplanet/data/
Moreover, geoplanet data will provide you type ( city,country,suburb etc) of the geographical place, along with a unique id.
https://developer.yahoo.com/geo/geoplanet/guide/concepts.html
You can do a lowercase, sanitized ( e.g. remove special characters and other anomalies) match of your needle string to the names present in this data.
If you do not want full file scans, first processing this data to store it in a fast lookup database like mongodb or redis will be beneficial.
I can suggest the following three options:
a) Using the Alchemy API: http://www.alchemyapi.com/
If you try their demo, places like France, Honolulu give the entity type as Country or City
b) Using TAGME: http://tagme.di.unipi.it/
TAGME connects every entity in a given text to the corresponding wikipedia page. Crawl the wikipedia page and check the infobox and filter
c) Using Wikipedia Miner: I was unable to find relevant links for this. However, this also works like TAGME.
Suggest you to try all three and do majority voting for each instance.

Resources