Google nearbyplaces api bounds not working - api

I want to search all the nearby places within a bounding box using e,g
https://maps.googleapis.com/maps/api/place/nearbysearch/json?bounds=41.35,-81.8|41.54,-81.5&key='mykey'
but received this:
{
"html_attributions" : [],
"results" : [],
"status" : "INVALID_REQUEST"
}
Any idea on how to make the correct call?
Thanks

Related

Google Sheets API Chart - change a given datapoint fillcolor

In Google Sheets API, when using a chart shape, how can I colour a given datapoint a custom RGB? In the image below I have changed the color of 3 random datapoints. Is this possible?
It is possible to change the color and use a custom RGB color. If you already have the chart created, all you need to do is to use the batchUpdate method, and when creating the request include updateChartSpecRequest, then you'll need to select the type of chart that you are updating. In your case, based on the screenshot it would be basicChart, then from the chart, you want to update the series since those are the ones that generate the columns, and you can modify the color parameter there according to the official documentation.
Depending on what you want to end up doing, the structure of the request may end up being similar to this:
Request:
'request' : [
{
"updateChartSpec": {
"chartId": integer,
"spec": {
"basicChart": {
"series": [
{
"color": {
{
"red": number,
"green": number,
"blue": number,
"alpha": number
}
},
}
]
},
}
},
}
]
Note:
If you want to do it upon creation, instead of using updateChartSpec you would want to use addChart.
References:
updateChartSpecRequest
Color
BasicChartSeries
BasicChartSpec
addChart

Google Vision Text Detection returns too much unnecesary data

When using Google Vision to run text detection on a menu, the response from their API is way too large and returns way too much data that I don't need. I just want the text from the menu, not all the coordinates that come with the response. I can't find anything about narrowing down the response in any documentation i've read. Does someone know how to specify what fields get returned in the response?
Heres my request:
POST: https://vision.googleapis.com/v1/images:annotate?key=<MY_KEY>
BODY:
{
"requests": [
{
"image": {
"content": "...base64-encoded-image-content..."
},
"features": [
{
"type": "TEXT_DETECTION"
}
]
}
]
}
I figured it out. I could not find any documentation on how to do this, I had to just guess for like half an hour. If someone knows of any documentation on this let me know.
Anyway you can use the "fields" parameter to narrow down the response like so:
POST: https://vision.googleapis.com/v1/images:annotate?key=<MY_KEY>&fields=responses.fullTextAnnotation.text
This will only return the menu text from the Google Vision text detection API

Is there a way to add google plus reviews to our website?

Is there a way to add google plus reviews to our website? Ideally it would be great if there was a way to have the reviews automatically update on our site as they came in.
So far I haven't really found anything. Does anyone have any ideas?
The Google Maps Places Details Api response includes up to five reviews. I'm not aware of any other Google APIs that provide access to Place reviews.
{
...
"reviews" : [
{
"aspects" : [
{
"rating" : 3,
"type" : "quality"
}
],
"author_name" : "Simon Bengtsson",
"author_url" : "https://plus.google.com/104675092887960962573",
"language" : "en",
"rating" : 5,
"text" : "Just went inside to have a look at Google. Amazing.",
"time" : 1338440552869
}
]
...
}

How do I get region / district polygon boundaries data from google Maps? [duplicate]

This question already has answers here:
Which API method provides the drawing of a city's boundaries?
(2 answers)
Closed 7 years ago.
When I search for a region in Google Maps, for example: "Kuala Lumpur", it will show me the polygon boundary of that region.
I know that Google provide its Maps data via Google Places API.
So, I query the term "Kuala Lumpur", like this: https://maps.googleapis.com/maps/api/place/autocomplete/json?input=kuala%20lumpur&types=(cities)
From that I got place ID
"place_id" : "ChIJ5-rvAcdJzDERfSgcL1uO2fQ",
Then, I query the place ID to Google Places API (place details), like this:
https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJ5-rvAcdJzDERfSgcL1uO2fQ
The geometry data returned only give me location coordinate and viewport:
"geometry" : {
"location" : {
"lat" : 3.139003,
"lng" : 101.686855
},
"viewport" : {
"northeast" : {
"lat" : 3.245252,
"lng" : 101.758509
},
"southwest" : {
"lat" : 3.0327539,
"lng" : 101.6152019
}
}
}
How do I get the complex polygon boundary points of a region?
This data is not available from the Google Maps APIs. An alternative solution would be to use KML data, which can probably be found online, and the URL can be retrieved. This can be imported into the map using the URL using google.maps.KmlLayer.

Twitter typeahead.js having trouble showing suggestions when data fetched from remote

I am having trouble displaying results as suggestions on entering text in input box.
<input type="text" id="search_country" class="form-control" placeholder="Add country">
Below is my typeahead code:
$('#search_country').typeahead({
name: 'countries',
valueKey: 'name',
remote: {
url: '/user/countries/%QUERY',
filter: function (parsedResponse) {
return parsedResponse;
}
}
});
I am getting json response in the below format:
[{"image": "india.jpeg", "name": "India"},
{"image": "germany.jpeg", "name": "Germany"}]
However the results are not showing up as suggestions below input box.
Rather in console I am finding an error similar to error given below:
Uncaught TypeError: Cannot use 'in' operator to search for '14771' in
[{"image": "india.jpeg", "name": "India"},
{"image": "germany.jpeg", "name": "Germany"}]
Where am I going wrong?
I want the result to contain a list of countries with each list item having image at left and name at right.
In your example the filter is doing nothing, I would remove it.