thadk / youthmappers-chapter-map

embedd-able 2017 chapter map for YouthMapper website (was a gist)

Home Page:https://youthmappers.org/chapters

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This repository holds the source code for http://youthmappers.org/chapters main version that uses Mapbox GL.js to display content from a Google Sheet, with particular columns.

To control the chapters shown, request access to the YouthMappers Google Sheet.

It can be live-edited using BlockBuilder.org once forked.

Enabling Cross Origin requests to Google Sheets CSV

It relies on Amazon Web Services API Gateway resource to Google Sheets set up as shown below to download the CSV and share it onward as an API (avoid its proxy feature). It should be deployed to a stage: Where the HTTP URL for the spreadsheet to use is: GET https://docs.google.com/spreadsheets/d/13yswnN49P0dsO5BS2FJYaVUIjsnuWbzA3UxvhcLUsYI/export?format=csv&id=13yswnN49P0dsO5BS2FJYaVUIjsnuWbzA3UxvhcLUsYI

  • Wherever possible, change application/json to text/csv.

  • Ensure Access-Control-Allow-Origin is set to '*' for the "Integration Response">Header Mappings section.

  • Also use the "Enable CORS" action.

  • Place the URL offered in stage into the awsProxyUrl variable in index.html.

Fallback version for substandard WebGL browsers

The fallback version of the site that uses basic Mapbox.js is at: https://gist.github.com/thadk/be6de2478c8aae7656a582895de8ff08 A version of this on Wix is hardlinked to by the application and displayed when e.g. there are no graphics drivers installed in Windows and the user is on Chrome.

Template for schools

The HTML template shown for each school is in the templatize() function.

Updating Wix

Select-All of the index.html code in GitHub and paste into the iframe embed text area on the Chapter page of Wix to install a new version.

Mapbox GL acts differently in an iframe on mobile than it does running normally on this staging area server with BlockBuilder or Bl.ocks.org.

External javascript

There are 2 small javascript files which are referenced by the index.html and hosted from this repository using rawgit.com -- including util.js and csv2json.js . These could be brought inline to the index.html if needed or re-hosted in a new repository if they need to be modified.

Raven error tracking.

There is a raven tracking script which logs errors such as WebGL failures.

About

embedd-able 2017 chapter map for YouthMapper website (was a gist)

https://youthmappers.org/chapters


Languages

Language:HTML 53.8%Language:JavaScript 46.2%