Closed SelvarajKaruppusamy closed 4 years ago
Hi, @SelvarajKaruppusamy. Thanks for the suggestion.
I just ran the first two queries you provided with my API Key, and both give almost the same result. Please refer to Google Maps API Docs for more information.
I understand that somehow your case needs 'findplacefromtext' API, but it only throws candidates' ids, not prediction results. Using such API sounds sort of workaround to me. Thus, it is not the best practice to add to this package in my opinion.
My first suggestion is to figure out why there is no result in your case, it should definitely throw some results and I don't think it is 'strictbounds' problem. Another suggestion is to fork this package and customize as you need, then add to your project.
Below are the results on my side with the APIs you provided.
{
"predictions": [
{
"description": "Brewsky, 19th Main Road, Jeewan Griha Colony, 2nd Phase, J. P. Nagar, 벵갈루루 카르나타카",
"id": "ec3759d41338fa988a520c09a7c20d5a8d605b80",
"matched_substrings": [
{
"length": 7,
"offset": 0
}
],
"place_id": "ChIJCbkJxBMVrjsRq0aAA3mwudg",
"reference": "ChIJCbkJxBMVrjsRq0aAA3mwudg",
"structured_formatting": {
"main_text": "Brewsky",
"main_text_matched_substrings": [
{
"length": 7,
"offset": 0
}
],
"secondary_text": "19th Main Road, Jeewan Griha Colony, 2nd Phase, J. P. Nagar, 벵갈루루 카르나타카"
},
"terms": [
{
"offset": 0,
"value": "Brewsky"
},
{
"offset": 9,
"value": "19th Main Road"
},
{
"offset": 25,
"value": "Jeewan Griha Colony"
},
{
"offset": 46,
"value": "2nd Phase"
},
{
"offset": 57,
"value": "J. P. Nagar"
},
{
"offset": 70,
"value": "벵갈루루"
},
{
"offset": 75,
"value": "카르나타카"
}
],
"types": [
"bar",
"restaurant",
"food",
"point_of_interest",
"establishment"
]
},
{
"description": "Byg Brewski Brewing Company, Hennur Bagalur Road, Visthar, 벵갈루루 카르나타카",
"id": "03930f8798111b558228c95d9828df07eda02816",
"matched_substrings": [
{
"length": 27,
"offset": 0
}
],
"place_id": "ChIJY2_1IZ8ZrjsReuXcBMfC0Ws",
"reference": "ChIJY2_1IZ8ZrjsReuXcBMfC0Ws",
"structured_formatting": {
"main_text": "Byg Brewski Brewing Company",
"main_text_matched_substrings": [
{
"length": 27,
"offset": 0
}
],
"secondary_text": "Hennur Bagalur Road, Visthar, 벵갈루루 카르나타카"
},
"terms": [
{
"offset": 0,
"value": "Byg Brewski Brewing Company"
},
{
"offset": 29,
"value": "Hennur Bagalur Road"
},
{
"offset": 50,
"value": "Visthar"
},
{
"offset": 59,
"value": "벵갈루루"
},
{
"offset": 64,
"value": "카르나타카"
}
],
"types": [
"bar",
"restaurant",
"food",
"point_of_interest",
"establishment"
]
},
{
"description": "Byg Brewski Brewing Company, Kaikondrahalli, 벵갈루루 카르나타카",
"id": "74924d4863606f3411b2321495bcf44739b3509e",
"matched_substrings": [
{
"length": 27,
"offset": 0
}
],
"place_id": "ChIJ6VlNkBETrjsRTQamSEJHQiI",
"reference": "ChIJ6VlNkBETrjsRTQamSEJHQiI",
"structured_formatting": {
"main_text": "Byg Brewski Brewing Company",
"main_text_matched_substrings": [
{
"length": 27,
"offset": 0
}
],
"secondary_text": "Kaikondrahalli, 벵갈루루 카르나타카"
},
"terms": [
{
"offset": 0,
"value": "Byg Brewski Brewing Company"
},
{
"offset": 29,
"value": "Kaikondrahalli"
},
{
"offset": 45,
"value": "벵갈루루"
},
{
"offset": 50,
"value": "카르나타카"
}
],
"types": [
"bar",
"restaurant",
"food",
"point_of_interest",
"establishment"
]
},
{
"description": "Brewsky Corp Office, 14th Cross Road, Jeewan Sathi Colony, 1st Phase, J. P. Nagar, 벵갈루루 카르나타카",
"id": "88477b0f7b565757d3a69d8bd6c932e2b4794e89",
"matched_substrings": [
{
"length": 7,
"offset": 0
}
],
"place_id": "ChIJidSk0GwVrjsRMTb1b9mgkGM",
"reference": "ChIJidSk0GwVrjsRMTb1b9mgkGM",
"structured_formatting": {
"main_text": "Brewsky Corp Office",
"main_text_matched_substrings": [
{
"length": 7,
"offset": 0
}
],
"secondary_text": "14th Cross Road, Jeewan Sathi Colony, 1st Phase, J. P. Nagar, 벵갈루루 카르나타카"
},
"terms": [
{
"offset": 0,
"value": "Brewsky Corp Office"
},
{
"offset": 21,
"value": "14th Cross Road"
},
{
"offset": 38,
"value": "Jeewan Sathi Colony"
},
{
"offset": 59,
"value": "1st Phase"
},
{
"offset": 70,
"value": "J. P. Nagar"
},
{
"offset": 83,
"value": "벵갈루루"
},
{
"offset": 88,
"value": "카르나타카"
}
],
"types": [
"point_of_interest",
"establishment"
]
},
{
"description": "Brewsky & Co., Lubuk Baja Kota, Batam City, 케풀라우안리아우 인도네시아",
"id": "d9128c6fb1c5a0970f60cf15ffefed89ef427f94",
"matched_substrings": [
{
"length": 7,
"offset": 0
}
],
"place_id": "ChIJ3yGo5CmK2TERH8DjH1znO2E",
"reference": "ChIJ3yGo5CmK2TERH8DjH1znO2E",
"structured_formatting": {
"main_text": "Brewsky & Co.",
"main_text_matched_substrings": [
{
"length": 7,
"offset": 0
}
],
"secondary_text": "Lubuk Baja Kota, Batam City, 케풀라우안리아우 인도네시아"
},
"terms": [
{
"offset": 0,
"value": "Brewsky & Co."
},
{
"offset": 15,
"value": "Lubuk Baja Kota"
},
{
"offset": 32,
"value": "Batam City"
},
{
"offset": 44,
"value": "케풀라우안리아우"
},
{
"offset": 53,
"value": "인도네시아"
}
],
"types": [
"bar",
"point_of_interest",
"establishment"
]
}
],
"status": "OK"
}
{
"predictions": [
{
"description": "Brewsky, 19th Main Road, Jeewan Griha Colony, 2nd Phase, J. P. Nagar, 벵갈루루 카르나타카",
"id": "ec3759d41338fa988a520c09a7c20d5a8d605b80",
"matched_substrings": [
{
"length": 7,
"offset": 0
}
],
"place_id": "ChIJCbkJxBMVrjsRq0aAA3mwudg",
"reference": "ChIJCbkJxBMVrjsRq0aAA3mwudg",
"structured_formatting": {
"main_text": "Brewsky",
"main_text_matched_substrings": [
{
"length": 7,
"offset": 0
}
],
"secondary_text": "19th Main Road, Jeewan Griha Colony, 2nd Phase, J. P. Nagar, 벵갈루루 카르나타카"
},
"terms": [
{
"offset": 0,
"value": "Brewsky"
},
{
"offset": 9,
"value": "19th Main Road"
},
{
"offset": 25,
"value": "Jeewan Griha Colony"
},
{
"offset": 46,
"value": "2nd Phase"
},
{
"offset": 57,
"value": "J. P. Nagar"
},
{
"offset": 70,
"value": "벵갈루루"
},
{
"offset": 75,
"value": "카르나타카"
}
],
"types": [
"bar",
"restaurant",
"food",
"point_of_interest",
"establishment"
]
},
{
"description": "Byg Brewski Brewing Company, Hennur Bagalur Road, Visthar, 벵갈루루 카르나타카",
"id": "03930f8798111b558228c95d9828df07eda02816",
"matched_substrings": [
{
"length": 27,
"offset": 0
}
],
"place_id": "ChIJY2_1IZ8ZrjsReuXcBMfC0Ws",
"reference": "ChIJY2_1IZ8ZrjsReuXcBMfC0Ws",
"structured_formatting": {
"main_text": "Byg Brewski Brewing Company",
"main_text_matched_substrings": [
{
"length": 27,
"offset": 0
}
],
"secondary_text": "Hennur Bagalur Road, Visthar, 벵갈루루 카르나타카"
},
"terms": [
{
"offset": 0,
"value": "Byg Brewski Brewing Company"
},
{
"offset": 29,
"value": "Hennur Bagalur Road"
},
{
"offset": 50,
"value": "Visthar"
},
{
"offset": 59,
"value": "벵갈루루"
},
{
"offset": 64,
"value": "카르나타카"
}
],
"types": [
"bar",
"restaurant",
"food",
"point_of_interest",
"establishment"
]
},
{
"description": "Byg Brewski Brewing Company, Kaikondrahalli, 벵갈루루 카르나타카",
"id": "74924d4863606f3411b2321495bcf44739b3509e",
"matched_substrings": [
{
"length": 27,
"offset": 0
}
],
"place_id": "ChIJ6VlNkBETrjsRTQamSEJHQiI",
"reference": "ChIJ6VlNkBETrjsRTQamSEJHQiI",
"structured_formatting": {
"main_text": "Byg Brewski Brewing Company",
"main_text_matched_substrings": [
{
"length": 27,
"offset": 0
}
],
"secondary_text": "Kaikondrahalli, 벵갈루루 카르나타카"
},
"terms": [
{
"offset": 0,
"value": "Byg Brewski Brewing Company"
},
{
"offset": 29,
"value": "Kaikondrahalli"
},
{
"offset": 45,
"value": "벵갈루루"
},
{
"offset": 50,
"value": "카르나타카"
}
],
"types": [
"bar",
"restaurant",
"food",
"point_of_interest",
"establishment"
]
},
{
"description": "Brewsky Corp Office, 14th Cross Road, Jeewan Sathi Colony, 1st Phase, J. P. Nagar, 벵갈루루 카르나타카",
"id": "88477b0f7b565757d3a69d8bd6c932e2b4794e89",
"matched_substrings": [
{
"length": 7,
"offset": 0
}
],
"place_id": "ChIJidSk0GwVrjsRMTb1b9mgkGM",
"reference": "ChIJidSk0GwVrjsRMTb1b9mgkGM",
"structured_formatting": {
"main_text": "Brewsky Corp Office",
"main_text_matched_substrings": [
{
"length": 7,
"offset": 0
}
],
"secondary_text": "14th Cross Road, Jeewan Sathi Colony, 1st Phase, J. P. Nagar, 벵갈루루 카르나타카"
},
"terms": [
{
"offset": 0,
"value": "Brewsky Corp Office"
},
{
"offset": 21,
"value": "14th Cross Road"
},
{
"offset": 38,
"value": "Jeewan Sathi Colony"
},
{
"offset": 59,
"value": "1st Phase"
},
{
"offset": 70,
"value": "J. P. Nagar"
},
{
"offset": 83,
"value": "벵갈루루"
},
{
"offset": 88,
"value": "카르나타카"
}
],
"types": [
"point_of_interest",
"establishment"
]
}
],
"status": "OK"
}
{
"candidates": [
{
"place_id": "ChIJCbkJxBMVrjsRq0aAA3mwudg"
},
{
"place_id": "ChIJidSk0GwVrjsRMTb1b9mgkGM"
}
],
"status": "OK"
}
@fysoul17 I have checked multiple times but don't get any results with strictbounds enabled. Could you please try the below query once again?
My Response:
{
"predictions": [
],
"status": "ZERO_RESULTS"
}
Please let me know if you need more info.
@SelvarajKaruppusamy Below is the result of the API. It works. I think you need to check your API setting.
{
"predictions": [
{
"description": "Brewsky, 19th Main Road, Jeewan Griha Colony, 2nd Phase, J. P. Nagar, 벵갈루루 카르나타카",
"id": "ec3759d41338fa988a520c09a7c20d5a8d605b80",
"matched_substrings": [
{
"length": 7,
"offset": 0
}
],
"place_id": "ChIJCbkJxBMVrjsRq0aAA3mwudg",
"reference": "ChIJCbkJxBMVrjsRq0aAA3mwudg",
"structured_formatting": {
"main_text": "Brewsky",
"main_text_matched_substrings": [
{
"length": 7,
"offset": 0
}
],
"secondary_text": "19th Main Road, Jeewan Griha Colony, 2nd Phase, J. P. Nagar, 벵갈루루 카르나타카"
},
"terms": [
{
"offset": 0,
"value": "Brewsky"
},
{
"offset": 9,
"value": "19th Main Road"
},
{
"offset": 25,
"value": "Jeewan Griha Colony"
},
{
"offset": 46,
"value": "2nd Phase"
},
{
"offset": 57,
"value": "J. P. Nagar"
},
{
"offset": 70,
"value": "벵갈루루"
},
{
"offset": 75,
"value": "카르나타카"
}
],
"types": [
"bar",
"restaurant",
"food",
"point_of_interest",
"establishment"
]
},
{
"description": "Byg Brewski Brewing Company, Hennur Bagalur Road, Visthar, 벵갈루루 카르나타카",
"id": "03930f8798111b558228c95d9828df07eda02816",
"matched_substrings": [
{
"length": 27,
"offset": 0
}
],
"place_id": "ChIJY2_1IZ8ZrjsReuXcBMfC0Ws",
"reference": "ChIJY2_1IZ8ZrjsReuXcBMfC0Ws",
"structured_formatting": {
"main_text": "Byg Brewski Brewing Company",
"main_text_matched_substrings": [
{
"length": 27,
"offset": 0
}
],
"secondary_text": "Hennur Bagalur Road, Visthar, 벵갈루루 카르나타카"
},
"terms": [
{
"offset": 0,
"value": "Byg Brewski Brewing Company"
},
{
"offset": 29,
"value": "Hennur Bagalur Road"
},
{
"offset": 50,
"value": "Visthar"
},
{
"offset": 59,
"value": "벵갈루루"
},
{
"offset": 64,
"value": "카르나타카"
}
],
"types": [
"bar",
"restaurant",
"food",
"point_of_interest",
"establishment"
]
},
{
"description": "Byg Brewski Brewing Company, Kaikondrahalli, 벵갈루루 카르나타카",
"id": "74924d4863606f3411b2321495bcf44739b3509e",
"matched_substrings": [
{
"length": 27,
"offset": 0
}
],
"place_id": "ChIJ6VlNkBETrjsRTQamSEJHQiI",
"reference": "ChIJ6VlNkBETrjsRTQamSEJHQiI",
"structured_formatting": {
"main_text": "Byg Brewski Brewing Company",
"main_text_matched_substrings": [
{
"length": 27,
"offset": 0
}
],
"secondary_text": "Kaikondrahalli, 벵갈루루 카르나타카"
},
"terms": [
{
"offset": 0,
"value": "Byg Brewski Brewing Company"
},
{
"offset": 29,
"value": "Kaikondrahalli"
},
{
"offset": 45,
"value": "벵갈루루"
},
{
"offset": 50,
"value": "카르나타카"
}
],
"types": [
"bar",
"restaurant",
"food",
"point_of_interest",
"establishment"
]
},
{
"description": "Brewsky Corp Office, 14th Cross Road, Jeewan Sathi Colony, 1st Phase, J. P. Nagar, 벵갈루루 카르나타카",
"id": "88477b0f7b565757d3a69d8bd6c932e2b4794e89",
"matched_substrings": [
{
"length": 7,
"offset": 0
}
],
"place_id": "ChIJidSk0GwVrjsRMTb1b9mgkGM",
"reference": "ChIJidSk0GwVrjsRMTb1b9mgkGM",
"structured_formatting": {
"main_text": "Brewsky Corp Office",
"main_text_matched_substrings": [
{
"length": 7,
"offset": 0
}
],
"secondary_text": "14th Cross Road, Jeewan Sathi Colony, 1st Phase, J. P. Nagar, 벵갈루루 카르나타카"
},
"terms": [
{
"offset": 0,
"value": "Brewsky Corp Office"
},
{
"offset": 21,
"value": "14th Cross Road"
},
{
"offset": 38,
"value": "Jeewan Sathi Colony"
},
{
"offset": 59,
"value": "1st Phase"
},
{
"offset": 70,
"value": "J. P. Nagar"
},
{
"offset": 83,
"value": "벵갈루루"
},
{
"offset": 88,
"value": "카르나타카"
}
],
"types": [
"point_of_interest",
"establishment"
]
}
],
"status": "OK"
}
I will update if once I get this working. Thank you, @fysoul17.
Closing as there are no further updates.
Please re-open this when there is an update.
On search, not all places are listed when 'strictbounds' is enabled
Hi @fysoul17, first of all, thank you very much for creating this package. I am using this package to find a place from a specific region, but it doesn't work when the 'strictbounds' parameter is enabled.
strictbounds disabled, valid results https://maps.googleapis.com/maps/api/place/autocomplete/json?input=brewsky&inputtype=textquery®ion=in&key=YOUR_API_KEY
strictbounds enabled, no results https://maps.googleapis.com/maps/api/place/autocomplete/json?input=brewsky&inputtype=textquery®ion=in&key=YOUR_API_KEY&strictbounds=true
Possible Solution I think this behavior is because of using
/autocomplete
API (via google_maps_webservice) instead of the/findplacefromtext
API.This works, https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=brewsky&inputtype=textquery®ion=in&key=YOUR_API_KEY&strictbounds=true
I agree that this approach will cost (places * n) additional API requests since the place details need to be fetched using the
/place/details
API, https://maps.googleapis.com/maps/api/place/details/json?place_id=ChIJCbkJxBMVrjsRq0aAA3mwudg&key=YOUR_API_KEYMaybe this approach can be supported on opt-in and disabled by default. I don't know a better way of doing this, suggestions welcomed.
Moreover, the dependency package google_maps_webservice doesn't support finding the places using
/findplacefromtext
API now. I would be able to submit a PR if this is the only solution.I haven't used Google maps API's a lot, please correct me if this doesn't make much sense. What do you think?