find a single specific place with google places api - google-places-api

I was wondering if it is possible to find a specific place using the google places api.
I know the name of the place, the address or website url, and the coordinates.
I need this to get the ratings this place has.
Is this possible? If not, is it going to be?

I think your best bet would be to do a nearbysearch with the location (lat,long), a small radius, and the name and types parameters to narrow it down. If you are targeting a specific place, then you can just manually find it in the results and use its reference for a Details request in your solution.
If the target place can be dynamic, for example based on user input, then you might want to show the user the list of results and let them choose the correct one. I don't think there's a way to guarantee that you will always get exactly the result you're looking for as, say, the first result in the list. Experiment with different types of requests and parameters and try to get a sense for the behaviour of the responses to find what will work best for your solution.

Related

GoogleMaps Autocomplete (Places API)

I am trying to fetch airports using the Places API autocomplete feature.
Looking at the types parameter, if this is an airport I display the result or else show it as no airports found.
I want to enhance this app, I want to show terminals within each Airport object that I display on the front end.
I have found the nearby search within places API but it is difficult to create a search query using keyword, and type to get exact results for all the airports around the world.
Does anyone have any idea as to what would be the best way to get airports and their terminals using the Places API?
Well I'm not sure if this is really your expected result but here's what I tried:
Get the placeId of an airport using Place Autocomplete.
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=dublin&radius=500&types=airport&key=API_KEY
Then use that placeId to do a Place Details request and get the coordinates of the airport.
https://maps.googleapis.com/maps/api/place/details/json?place_id=ChIJLxmTab4RZ0gRVfMlt7UbElU&key=API_KEY
This also returns an overview of the airport wherein in this case the result says: "
"Airport with 2 runways, a 2nd terminal opened in 2010 plus buses into Dublin & other towns/cities."
Then after having the coordinates, I use that to do a Nearby Search request.
https://maps.googleapis.com/maps/api/place/nearbysearch/json?keyword=terminal&location=53.42644809999999,-6.249909799999999&radius=10000&key=API_KEY
This managed to get the terminals around it, I just threw in some radius but I guess it should be different on other locations. I also tried this with other Airports and it somehow worked.
If this won't work for your use case. Another thing I think you could do is to store the coordinates of known airports (Please note that coordinates/placeID are the only thing that is allowed for us to store/cache. Please see Specific Terms). And create an object which also stores the coordinate of their corresponding terminals. This would be an extensive work if you want to do this with airports all around the world.
Hope this helps.

Get Github Issue based only on title

I need to modify the body of an existing GitHub issue in a Project. All I'll be passed is the title of the issue, and a word (the word exists in the body, and I'll just need to fill the checkbox next it).
It looks like to do this I'll need to use the GET API to get the body of the issue, modify it, and then use the EDIT API to swap in the new body. However the GET API can only be called with the issue number. I need to do all this as quickly as possible. Is there some way to search via an API call?
Thoughts much appreciated!
Edit: All my issues are in the same project (and issue titles will be unique there). I've also recently discovered Github's GraphQL API, which may be applicable here.
You can use the issue search endpoint with the in and repo¹ keywords:
GET /search/issues?q=text+to+search+in:title+repo:some/repo
Of course, issue titles aren't guaranteed to be unique. You'll have to request each of the issues that comes back and see if its body contains the word you're looking for. Even in that case you could get multiple positive results.
It would be much better if you could search by issue number.
¹I've assumed that you really mean "repository" when you say "project". But if you're actually talking about GitHub Project Boards you can use the project keyword as well or instead.

Is there an OSM XAPI tag/value list?

I'm new to OSM querying, but would like to query vector data for a large area. Thus I need to limit the results I would like to get by tagging the request.
http://www.informationfreeway.org/api/0.6/way[tag=value][bbox=x,y,z,j]
I'd like to filter for specific tag/values when querying for a way. Though I don't know which tags/values exist. Is there a list listing the most common of them?
You are approaching your problem from the wrong direction. The number of different tags is almost unlimited. According to taginfo there are currently 75 380 856 different tags. I'm pretty sure you are not interested in most of them. Likewise you are probably not even interested in many of the most common tags.
What data do you want to query?
The OSM wiki should be your starting point for generating a list of tags you are interested in. For a generic overview take a look at the map features. Are you interested in streets? Then visit at the highway key. Routing? Then take a look at the routing wiki page.
Always remember that these lists aren't complete. People can use any tag they like (but should use well-established tags whenever possible of course).
Also consider using Overpass API instead of XAPI. Overpass API is much more powerful.

How to uniquly identify an two objects in same page having same url

I Have two objects in same page but with different locations(tabs), I want to verify those objects each a part ...
i cant uniquely any of objects because the have same properties.
These objects clearly are unique to a point because they have completely different text, this means that you will be able to create an object to match only one of them. My suggestion would be to look for the object by using its text property, one of them will always have "Top Ranking" the other you wil need to turn into a regular expression for the text and will be something "Participants (\d+)".
I am assuming that this next answer is unlikely to be possible so saved it for after the answer you are likely to use but the best solution would of course be to get someone with access to give these elements ids for you to search for. This will in the long term be much easier for you to maintain and not using text will allow this test to run in any language.
Manaysah, do these objects have different indexes? Use the object spy and determine which index they have, the ordinal identifier index may be a solution to your problem. You could also try adding an innertext object property if possible, using a wildcard for the number inside the () as it appears dynamic.
try using xpath for the objects...xpath will definitely be different

Detecting misspelled words

I have a list of airport names and my users have the possibility to enter one airport name to select it for futher processing.
How would you handle misspelled names and present a list of suggestions?
Look up Levenshtein distances to match a correct name against a given user input.
http://norvig.com/spell-correct.html
does something like levenshtein but, because he doesnt go all the way, its more efficient
Employ spell check in your code. The list of words should contain only correct spellings of airports.
This is not a great way to do this. You should either go for a control that provides auto complete option or a drop down as someone else suggested.
Use AJAX if your technology supports.
I know its not what you asked, but if this is an application where getting the right airport is important (e.g. booking tickets) then you might want to have a confirmation stage to make sure you have the right one. There have been cases of people getting tickets for the wrong Sydney, for instance.
It may be better to let the user select from the list of airport names instead of letting them type in their own. No mistakes can be made that way.
While it won't help right away, you could keep track of typos, and see which name they finally enter when a correct name is entered. That way you can track most common typos, and offer the best options.
Adding to Kevin's suggestion, it might be a best of both worlds if you use an input box with javascript autocomplete. such as jquery autocomplete
edit: danish beat me :(
There may be an existing spell-check library you can use. The code to do this sort of thing well is non-trivial. If you do want to write this yourself, you might want to look at dictionary trie's.
One method that may work is to just generate a huge list of possible error words and their corrections (here's an implementation in Python), which you could cache for greater performance.

Resources