Google Places API autocomplete specific city - autocomplete

I have some questions about google places api for android.
This is the request that is being called:
https://maps.googleapis.com/maps/api/place/autocomplete/json?sensor=false&key=API_KEY&components=country:hr&language=hr&input=lad
The issue is that I want only addresses within specific city. Is that possible?
Here is the quote from
Google Places API autocomplete
that suggests that it should work.
Blockquote the (regions) type collection instructs the Place service to return any result matching the following types:
locality
sublocality
postal_code
country
administrative_area1
administrative_area2
Blockquote the (cities) type collection instructs the Place service to return results that match either locality or administrative_area3.
So I would like to specify citry or a postal code in order to filter only addreses from that city.
--EDIT--
This approach doesn't work either.
maps.googleapis.com/maps/api/place/autocomplete/json?sensor=false&key=API_KEY&types=geocode&location=45.811093,15.974121&radius=12000&components=country:hr&language=hr&input=lad

Solution
I've added CIty name in input string
city_name+street like Zagreb+fal in order to get all the streets from Zagreb with fal* in their name.
It seems to be working oke.

Related

Restrict Countries and Cites in Flutter using session token

the following string of url correctly gives me locations within my country:
String autocompleteURL="https://maps.googleapis.com/maps/api/place/autocomplete/json?input=$placeName&key=$mapKey&sessiontoken=1234567890&components=country:my";` //no Error
'my' gives all cities in Malaysia.
However, I want to restrict it to malacca within malaysia.I don't know how to use components for a particular city using session token.I searched the autocomplete documentation from google developers website.
After that, I changed the above code into:
String autocompleteURL= "https://maps.googleapis.com/maps/api/place/autocomplete/xml?input=$placeName&types=establishment&location=2.25386,-102.27273&radius=500&key=$mapKey"; //error after change.
However, only this line gives me error after change.
Here, long and latitude values are the values for Malacca.
I am using my program in flutter.
change your output type from xml to json :
String autocompleteURL= "https://maps.googleapis.com/maps/api/place/autocomplete/json?input=$placeName&types=establishment&location=2.25386,-102.27273&radius=500&key=$mapKey"; //error after change.

Retrive all districts based on city name from REST query

I've searched for solution for that problem on here-api documentation but I can't really find it out ! I'm starting doubt if this even possible.
Ok so basicly what i need to know for now:
1. Is this even possible on this platform ?
2. Using exactly which 'module' (eg. PLATFORM DATA EXTENSION,BATCH GEOCODER)
There is no straight solution to get all districts in a city since district concept varies from one place to another(country-specific). Still you can try one of the below options:
administrative-areas-buildings category in places api
city-town-village category in places api
retrieveAreas mode in geocoder api (apply bbox or increase the radius of prox parameter and see if it works for your location)
Search Text in geocoder can also be used if you are search for districts which match a regex
You can check if the above 1) and 2) are applicable to your location using https://places.demo.api.here.com/places/v1/categories/places?at=41.8369%2C-87.684&app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg

How to restrict Bing Search API Queries by language & region

Using Bing Search API, is there any way to restrict searches by country? That is, an equivalent of Google Custom Search Engine's 'cr' parameter?
For instance, let's say I only want to find web pages from Spain that are available in English.
With Google Custom Search Engine I would use the parameters:
lr=lang_en # language = English
cr=countryES # country = Spain
However, the only related parameters I found for Bing Search API are
Markets, which seems to affect only the page's language
latitude & longitude: user's location (gl with Google), which weighs in location, but is not a strict filter.
The simplest way is not through the param, but rather modifying the search term (which is actually easier).
So let's say you want to search for the term London in Japanese> Simply do so by leveraging their advanced syntax and search for:
London language:ja
Where language:ja restricts the result to Japanese. You can see a list of language codes here.
If you want to include a region with it, add another advanced operator, loc:
London language:ja loc:es
The above search should return search for "London" written in Japanese, while being from Spain. The country code should be the same in the reference.

Trello Api Find Card By Name

How do I find card by name in trello api?
One way I could think of is that we simply get all the cards for a board using boards/[board_id]/cards and then try to match the name of each card with what we have. But that looks a very inefficient way to do it as it would involve too many comparisons.
Is there any other way such that we could simply take in a card name and board name and then get the required card object?
If you know the cardid or shortlink you can use this endpoint https://trello.com/docs/api/card/
Also maybe this could be helpful https://trello.com/docs/api/search/index.html#get-1-search
You can use the Search endpoint, defining to search only cards (modelTypes: 'cards') and specifying the card name in the query parameter.
For example: https://api.trello.com/1/search?modelTypes=cards&query=MySpecialCard
Note that, according to the documentation, you cannot specify the fields you want to search via specific parameters, but it is possible to do that using the query string (query parameter). For example, to search for a card named My Special Card that has This is my special card as description, you can make this request: https://api.trello.com/1/search?modelTypes=cards&query=name:"My Special Card" description:"This is my special card.".
Although I couldn't find it on the documentation, it seems that the string that you can use as the query parameter follows the same format as the one available when doing searches via the regular user interface: https://blog.trello.com/the-secrets-of-superior-trello-searches.

Use Google Places autocomplete vs nearbysearch with rankby=distannce

I am looking to use Google Places autocomplete to help user search for places near him/her. When using autocomplete in the example below, I get establishment that are very far from the location.
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=pizza&types=establishment&location=37.340871,%20-122.029642&rankby=distance&key=mykey
I assume Google considers the popularity of the establishment in the result set. My question: is there a way to get back the list sorted by proximity to the location, i.e. "turn off" the popularity index? (and to get similar functionality to the nearbysearch with autocomplete) ?
Why not just using nearbysearch? because nearbysearch does not perform well when only part of the name is entered as keyword ( I assume nearbysearch assume the 'keyword' parameter is the complete word).
Thanks for your help!