With Google Places API, I'm able to select a location and get several properties including its name, website, ph number etc.
However, i need to get the place category (food, gas station etc) but the method getPlaceTypes() gives me a List with integers, not a string/sequence of chars.
Also, how can I get paragraphs of info of that specific place? Is that possible? Or do I have to scrape from websites myself?
Thanks.
Here you can find the Place Types supported by Google Places API. The list of integers that you are receiving is of the well known types that you can find here. So you will need to transform the integers into your own text.
With Google Places is not currently possible to get detailed info of a place, not even using the more detailed place details that you receive when you query the Places API Web Service.
no api gives you the categories instead you have to explicitly provide category name in parameter for example for getting near by places.You can find categories list here https://developers.google.com/places/supported_types
Related
I have a gps coordinate, I wish to get a list of adresses inside it's certain radius. From these adresses I wish to select the ones that are companies and contain specific sector name. (clothing, finance, metallurgy, etc..), I thought the returned api object may contain the necessary information to make the distinction. Is there a free api that has the necessary functions to bring me closer to my goal ? (like google maps, google places, yahoo placefinder, and similar applications.)
Note: I use the MVEL language, I guess it has access to some Java functions so you can consider me writing Java, but any information considering the MVEL language is also appreciated.
Note2: Radius is not an essential requisite, it would be enough if I found the adresses in a certain district. The classification however, is necessary.
I think you can take a look into :
GoogleMapServicesJava
Particulary into the Places API service :
Places API
Where you can query a search sort by radius, place type, etc...
Hope that will help !
i want to build a weather app and i have some problems.
my big problems is places names! you know, i want that user find his location with two ways. with GPS and by searching. but my problem is that place names. how can find a database from whole places in the world?!
is it good idea that i store them in a database in my server? or there is some services that provide this functionality? if i have to create my own database how i can create a database like that. is there a database with city names and latitude/ longitude and other information? if a new location created how i can add it to the system? by hand?
the second problem is that after catching the city name how i can find that locations latitude/ longitude? it seems google has a Geocoder service but i don't know how it works. please help me. i just want to select a city name and find related coordinates...
The Google Maps API provides you with Geocoding, which allows you to turn strings like 'Santiago, Chile' or 'New York', into proper latitude/longitude coordinates. So in your code, you should perform an HTTP GET request to a URL like this one:
http://maps.googleapis.com/maps/api/geocode/json?address=Santiago,+Chile&sensor=true
And it returns a JSON object with a properly formatted address along with latitude and longitude information of the place you were looking up.
It's explained very thoroughly in the Google Maps API Geocoder documentation, so you should probably take a look at that. I'm no expert in Android development, but there should be some library that allows you to easily access what the Maps API has to offer in a clean way.
Maps API also provides you with a solution for Place Searching, and even input autocompletion, but all the examples I see are on JavaScript/HTML, so I'm not completely sure if there's an alternative in plain Java/Android to what you're trying to do. Nevertheless, you should take a look at basic place searching and place search autocompletion so you get a general sense of how it works.
There's an entire section in the Google Developers website dedicated to the Maps API on Android, so make sure to take a look at that aswell and you might find more useful information - sadly I have no experience with Android whatsoever so I can't really point you in any direction.
Good luck!
You could use the Google Maps Geocoding API. Querying coordinates returns a JSON response containing the current location in multiple levels of detail that you could parse.
E.g. for the position lat:40.714224 long: -73.961452, the query URL would look like the following:
http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=false
The result now contains the city and country, beside much more.
You can find more information on the API here: https://developers.google.com/maps/documentation/geocoding/
You could also try http://openweathermap.org/
I haven't used this extensively but I tried it enough that I know it works. It lets you query by location name or geographic coordinates, and the city name is included in the responses along with plenty of other data.
http://api.openweathermap.org/data/2.5/weather?lat=xx&lon=xx returns a weather object with city name & related data. API key is even optional so you can try it out very quickly.
I'm working on my first android application that uses the Google Places API. The issue I'm running into is that I don't know how to filter out the search results to only show the particular places I want and not everything within that type. For example, say I had a list of specific type of restaurant across the country and I wanted to only show those particular places how would I filter out those results for just the ones I wanted to show in my application. So say I wanted Italian restaurants but not just any random one, I want to display the ones that were part of a particular restaurant group or by a specific chef. Is there a way I can filter out just those if I have a list of their locations already? Thanks!
There is no exact way to do this with the Places API. You could possibly pass the restaurant group or chef name as a keyword parameter in your request. As the documentation states, the keyword parameter is:
A term to be matched against all content that Google has indexed for
this Place, including but not limited to name, type, and address, as
well as customer reviews and other third-party content.
If you also have the places you could try match the locations with the ones returned from your search, but this may not be reliable as the exact location Google has for the place may differ from the location you have for the place.
I am using the 'Twitter4j' library and I am just wondering if it is at all possible to return tweets within a location AND contain a certain keyword. I notice that on the official Twitter documentation it mentions this:
Bounding boxes are logical ORs. A locations parameter may be combined with track parameters, but note that all terms are logically ORd, so the query string track=twitter&locations=-122.75,36.8,-121.75,37.8 would match any tweets containing the term Twitter (even non-geo tweets) OR coming from the San Francisco area.
Which is unfortunate as it is not what I need, it's returning way too many tweets. Any idea on how I could get around this or is there something I'm missing in the library that could allow me to do it?
Library javadoc: http://twitter4j.org/en/javadoc/twitter4j/FilterQuery.html#locations
At the moment I have my filter code like this
twitter.filter(new FilterQuery().locations(sydney).track(keywords));
and have also tried each on its own line:
twitter.filter(new FilterQuery().locations(sydney).track(keywords));
twitter.filter(new FilterQuery().track(keywords));
Unfortunately, you are reading the documents correctly. I don't know enough about twitter4j to say if there's a method contained somewhere that will handle this for you more easily, but you can always just use a simple string comparison to see if your search terms are included in the tweet.
Not an answer but a Simple workaround:
I know most of people don't have GPS enabled when they tweet and others would not like to share their location!
But they are still sharing their location!! Guess how? On their profiles! Their hometown, their country is mostly visible, which can give you an approximate location of where the tweet came from! You can query for the user's profile and thus his/her location using the Rest API
twitter.showUser(userScreenName).getLocation();
Search for all keywords, if the location you wan't doesn't match, simply discard! In this way, you can get more number of tweets atleast
I'm trying to get the number of results from google for search term in Java.
eg. For the term "computer" :About 3,070,000,000 results.
Is it possible?
You should be able to do this with Java sample library for custom google search API.
http://code.google.com/p/google-api-java-client/wiki/APIs#CustomSearch_API
Also you can reduce the data transferred during service requests by specifying members that contain data elements that your application needs.
It is not as straightforward as one might think... You can write a Java program that reads the results of a Google search on a term like "computer", but the number of results will not be statically present in the output.
You will have to use the Google Custom Search Engine, or the JSON/Atom Custom Search API.