-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Join arbitrary data from google spreadsheets #47
Comments
Here are, once again, some snippets that may help. This is for CSV loading. Papa.parse library for loading CSVsSite. CDN: Loading a CSV in as an array of JSONs:
Note that this is an asynchronous call. I typically load the csv's at page load and keep them stored in a global var that's declared as an empty array from earlier. The functions needing it will most likely be run long after it's loaded, but if someone wants to be on the safe side they can do the async await or other hacks. Filtering the data:Suppose there are two columns: st_code and pc_code which will help you single out your row. You have those values at hand. Here's how to get the matching row:
Explanation: whatever evaluates to So if you want to access the value under Note on reading data from google spreadsheetsI've tried this by using some middle services.. didn't work out so well because it would take quite some time, or the call would error out every now and then. I prefer CSV files. Recently however I learned how to make a google apps script on the spreadsheet that can output everything as json or whatever as the default response when its URL is accessed. That'll take time to set up but is doable. It used to be much simpler a long time ago in a galaxy far away but now google likes to keep things complicated. |
Thank you @answerquest, will play with this.
Have been successful in using google sheet after using the publishing to the web option. This example loads geojson from github and makes a chloropleth using values in a google sheet. Completely decentralized with no Mapbox API call :D https://jsfiddle.net/planemad/04w9o3xz/ |
That's great! In 2015 it had been throwing up a CORS error or something. Glad to see it's working fine now. |
To enable dynamic visualization #32 , we need a convenient way to attach more properties to constituencies without needing to regenerate and update the Mapbox tileset.
A convenient way to do this would be to make data joins on the fly using a loaded CSV or Google sheets. Ref:
The text was updated successfully, but these errors were encountered: