How do you exclude streets from Google Places API? - google-places-api

How do you exclude streets from coming up when using the Google Places API? I want only cities and states to show if a user types in a location in the input field

I think you want to add types to your Place Autocomplete requests.
Concretely, types=(regions) will limit Autocomplete predictions to cities, states, and a few more. See Place Types in the API documentation for more details.

Related

How to search for locations using Tags inside OpenStreetMap

Using the Nominatim APIs, am able to do a search based on a query. However, all the results returned have a Tag associated with them, like leisure=fitness_centre.
How can I, thus, use the OpenStreetMap APIs to search a given location (say London) for all the fitness_centre tags? Idea is to be able to search the map, zero in a location (say London, Oxford etc.) and then search for all places/locations with Tag [leisure=fitness_centre]
Using Google Places API, one can search using tags using something like below (specifying type=gym) -
https://maps.googleapis.com/maps/api/place/search/json?location=51.509865,-0.118092&radius=50000&sensor=true&key=&types=gym
Only issue with the Google Places API is that they are extremely pricey!!, so looking for OpenStreetMap as an alternative.
For searching specific objects in OSM, Overpass API is usually a good choice.
There is a nice frontend available called overpass turbo. Open the wizard, enter "leisure=fitness_centre in London" and it will generate an appropriate query:
[out:json][timeout:25];
{{geocodeArea:London}}->.searchArea;
(
node["leisure"="fitness_centre"](area.searchArea);
way["leisure"="fitness_centre"](area.searchArea);
relation["leisure"="fitness_centre"](area.searchArea);
);
out body;
>;
out skel qt;
Then hit run to see the results on the map: https://overpass-turbo.eu/s/1fbg
Please note that the {{geocodeArea:London}}->.searchArea; part is a feature added by the overpass turbo frontend. Overpass API won't understand this geocoding request. Instead, you have to replace it with an area query and the corresponding relation ID (in this case area(id:3600065606)->.searchArea;).
Another thing to note is that Overpass API servers shouldn't be used for heavy queries or commercial purposes. If you need this kind of service then install your own Overpass API instance or use a commercial Overpass API provider.

How to get all images for a given hotel, using Self-Service Amadeus API?

We tried in many ways without success.
Can only get one main picture.
(There was a question posted before on this topic Amadeus Hotel API Images, however the answer doesn't work.)
You can get more images using the second endpoint of the Hotel Search API and adding the parameter &view=FULL_ALL_IMAGES
For example:
https://test.api.amadeus.com/v2/shopping/hotel-offers/by-hotel?hotelId=BGMILBGB&adults=2&roomQuantity=1&paymentPolicy=NONE&view=FULL_ALL_IMAGES

Is there a way to find all the relations that exists between two entities?

I need to populate an ontology in the domain of Music Artists. To get an understanding of the domain which I should populate, I need to find out,
1) All the possible objects related to the particular artist. (Song, Album, Movie etc.)
2) All the possible relations between this celebrity and the object. (Singer Object).
Is there any way to do this manually or through Google API?(I tried this manually by giving this on the google search bar. But it is a hard task to do it manually. Though if there is a way to speed this up, it would be sufficient at the moment.)
What you need is a way to query the web which will combine results from various websites and web pages and present a combined and coherent result to you based on your query. Currently this cannot be done for the web in general. However, the semantic web is an area of research that is trying to achieve exactly that.
Using semantic web technology it is possible to do such queries for parts of the web. DBpedia is a prominent semantic web project that aims to enable arbitrary queries across Wikipedia. DBPedia provides a live end-point that you can query using SPARQL. Referring to DBpedia will give you a brief overview of how this all fits together.
Accessing the live end-point you can run the following SPARQL-query that will give a list of musicians. Clicking on the links in the result page will provide you with more information on each musician.
SELECT ?subject
WHERE {
?subject a dbo:MusicalArtist .
}
Good luck!
Found a method to retrieve entities related to a particular object through google knowledge graph API.
Google Knowledge Graph API

Can I obtain the country name with Google Places API?

On the request for current place I receive a list of places. Every place has an address but that address is a string so I can't get only the country name.
Could someone help me on this matter?
Country is only explicitly available when using the Place Details API, not the Places API. (https://developers.google.com/maps/documentation/places/web-service/details)
You first need to look up a place_id for the specific place you're looking for. You then use your place_id to pull details from the Details API, which includes information like:
Fully formatted address, including country
Address components
Sample reviews
Phone # and website
Operating hours
If you have read the Google Places Autocomplete doc,you must know about API properties.you can use the type as '(region)' and will return you many results (plus country).And if you look inside address_components field (it's array with dynamic length),you will see,that the last item of array is what you need.Here is a great page to read a correct doc and try examples yourself.
http://www.w3docs.com/learn-javascript/places-autocomplete.html

How to get Country for Google Places API nearby search

I'm using Google Places API to get nearby places, but I've noticed that while I get the place names and addresses, the results don't include the Country.
Is there a way to get the country included in the results?
This is the call I'm using:
https://maps.googleapis.com/maps/api/place/nearbysearch/xml?location=<lat,lng>&radius=100&sensor=true&key=<api_key>
Thanks!
The Geocoding API is what you want.
Try
http://maps.googleapis.com/maps/api/geocode/json?address=Calgary,%20Alberta&sensor=false
it'll return fully formatted address info in several ways (split by administrative level, formatted as an address,etc.)
also the place Types blog in google api will help..link is here

Resources