The problems:
I need to get data in a kind of "relational" way.
GViz (Google Visualization API) is not available for GAS (Google Apps Script) HTML Service (see here: Can we use Google Chart Tools with Google Script HtmlService).
Getting all the functinality GViz delivers is a dream right now, so, instead, I'd be satisfied with DataTable and DataView objects and google.visualization.data.join(). I dont need charts right now.
All of this, as long as I cannot get full GViz on the client side, could be server side.
Being more explicit, I need to join some queries and not mess up with the normalized data.
Keep in mind that I'm using a Spreadsheet as a data container (the tables are composed of static and dynamic data).
Getting all the functionality from GViz is everyone's dream right now, but some of it is available through Charts Services in UiApps. I have no experience with HTML Service, so I can't speak for that.
https://developers.google.com/apps-script/service_charts
If you're manipulating a lot of data, have you looked at ScriptDB?
https://developers.google.com/apps-script/service_scriptdb
I currently use a set of spreadsheets and Charts Services for a dashboard and it works pretty well. I really wish I could make combo charts, though.
It looks like sometime between mid-March and now, GViz mostly works with HTML Service.
I'm very new to Google Apps Script myself, but I have managed to get TaffyDB working server side. I loaded it up as a library in case I want to use it across multiple projects.
I did have to add this line to make it work server side:
function setTimeout() {}
Not sure if the is necessarily sufficient, but it worked as a starting point.
Related
Google have decided to replace their Map Style tool with the Cloud-base Maps Styling.
The new Beta tool allows you to import JSON map styling, but it provides no way of exporting a map style created with the Beta tool.
A colleague of mine has created a custom Map Style, but now we need to copy it into another project, but there appears no way to do this. We can duplicate the style, but only into the same project.
Is there any way around this, eg. a GCP console command.
I've tried inspecting the network traffic to see if I can grab the config, but it's in a completely different format that can't be exported.
Edit: It may appear I've done no research on this question, but the fact is that because it's referring to a Beta GCP tool, there is very little information available on its use other than:
A blog post
A sidebar which concentrates on the publishing side
All the Maps API docs refer to using a Map ID, which isn't the problem here.
Another Edit:I've created an feature request, in case anyone is interested...
I would like to create a Map by the excel sheet values (.csv files too).
By using FusionTableLayer API, I think it is possible. At first step we could upload the excel values to the database. Then we create a map by the database annotated value. It is very good idea. This is what I wanted. But One thing is problem to me with FusionTableLayer API is google's Drive has been pointed for the fusion table. It means that all my business data will be shared with google. I don't want to be like that.
Instead of Google's drive My database has to be pointed out. From my database I would like to create a map with FusionTableLayer API. I have been searching through internet, I dont find this is possible. But I believe that it is possible. Please guile me to specify the way to trigger it out ?
Regards,
ArunRaj.
If you want to use your own database, then you cannot use the Fusion Table API as it's meant for the Google Infrastructure. You will have to find another API to take care of this.
One workaround I can suggest to you is to parse points you have as drawing objects for your map. So for each point, create new google.maps.Marker with the respective coordinates. Each region can be denoted with google.maps.Polygon, and lines with google.maps.Polyline. There's plenty more you can do, but it's just a bit more work, and possibly less secure depending on your implementation. Furthermore, you can also add info windows to each of those areas using the Google Maps API by attaching respective listeners to those objects created.
Hope this helps!
We are building a web application based on Google Drive API. We'd like to incorporate a facility of displaying who is viewing our "document" in real time like Google docs and spreadsheets are doing.
Implementing it from scratch would be quite challenging because of the necessity to track when a user leaves the page. So we'd first like to check if anything is already available for this purpose.
We have found out Google Analytics API may be helpful, but it can only give us a number, not user names.
Google Drive Realtime API looks promising and suitable for other needs of our development, however at the moment it's not clear whether it might help with displaying current viewers.
Any ideas on possible solutions would be greatly appreciated.
This is possible in the realtime API. See https://developers.google.com/drive/realtime/handle-events#collaborator_events
There is an example of it in the Realtime Playground.
I have that problem. When I set de URL of my request from my table in Fusion Tables, the chart does not work. It say 'Request timed out' when I play the App.
The code is:
var graficoHistoricoMensual=Charts.newAreaChart() .setDataSourceUrl('https://www.googleapis.com/fusiontables/v1/query?sql=select%20ANO,MES,%20count(INCIDENCIA)%20AS%20TotalIncidencias%20from ID_OF_THE_TABLEwhere%20ALMACEN=501%20group%20by%20ANO,MES%20&key=THE_KEY&alt=csv')
.setDataViewDefinition(Charts.newDataViewDefinition().setColumns([0,1]))
.build();
When I executed this URL on one tab of the browser it work perfectly.
Does Fusion Tables work with Google App Script and this method of the Charts Services?
I have never tried this, to answer you based on my experience, but from the error message it seems that Fusion Tables is just too slow for the Chart Service. Or, looking the other way, the Chart Service timeout is too low for Fusion Tables.
If that's really the case, you answer is no, you can not use fusion tables like this (using setDataSourceUrl).
But you can definitely use Fusion Tables data in Apps Script and pass to the Chart Services, you just need to grab the data yourself (using UrlFetchApp), parse it (using either JSON.parse or Utilities.parseCsv), and then create the charts datatable manually, Charts.newDataTable.
I have seen the two forms of reference to the Google Places Library/Service, using JavaScript vs calling the API directly, a number of times, but I don't understand the difference. The Google Docs don't describe anything about two methods of accessing the API.
For example, this question talks about 2 ways of accessing the API: OVER_QUERY_LIMIT in a loop
And it appears that there is some type of direct web access taking place in this question: Querying Google Places API using jQuery
Is this something where there was an old way that involved formatting URL parameters and the new way is by utilizing the JavaScript library calls?
FINAL SUMMARY EDIT: There are two distinct ways of requesting data from Google, as described in #Dan Nissenbaum's answer below. And since my original question, the QUERY_LIMIT question referenced above has been edited to also include more information about the two options.
Perhaps you are referring to the distinction between the Google Places API that is intended for use on the SERVER (i.e., utilizing PHP to call the Google Places API directly), and using the completely different approach of the Google Places Javascript Library in which the BROWSER executes Javascript using the Javascript library provided by Google (that internally wraps calls to the Google Places API, so that you, as a Javascript programmer, only need to understand the Javascript library provided by Google, and use that)?
Here are the two scenarios.
Scenario #1: Use the API directly. For this method, you must refer to Google's API documentation for the Google Places API: https://developers.google.com/maps/documentation/places/.
Using this API works as follows (giving a simple example only). Say you want to retrieve places within 1000 meters of latitude=-27.2531166, longitude=138.8655664. You need to hit a URL as described by the API documentation: https://developers.google.com/maps/documentation/places/#PlaceSearchRequests.
In this example, the URL looks like this (it's long):
https://maps.googleapis.com/maps/api/place/search/json?location=-27.2531166,138.8655664&radius=1000&sensor=false&key=AddYourOwnKeyHere
You need a key for your personal use, which I assume you have. There are other options you can specify, such as limiting the results to restaurants, etc.
When you hit this URL, the data will be returned in either JSON, or XML format, as specified by the text json in the URL above (use the text xml for xml). This data is returned exactly like data is returned from any URL call when you hit a URL in your browser.
You can test this by simply typing the URL directly in your browser, and see the results.
To use the API directly from code, you will need to use code that hits the external URL above within code and retrieves the results within code (for example, using the PHP CURL library, or using AJAX in Javascript).
Scenario #2: You use the Javascript library that Google provides that wraps the API, so you don't need to deal with it. I'll update the answer with more details about this, if you don't know what this is.
The docs do discuss the two different approaches. The Places Library utilizes the Google Places services from within the JavaScript Google Maps API. If you are using the Google Maps API in a browser, this is probably the approach for you:
https://developers.google.com/maps/documentation/javascript/places
There is also a web service, which allows you to query directly from your application. You query it using direct http calls to Google services. If you need access to the data on your server or a mobile device, this is the approach you want to take:
https://developers.google.com/maps/documentation/places