cugos/gus-api

Name: gus-api

Owner: CUGOS

Description: An API that converts Google Spreadsheets into GeoJSON

Created: 2018-05-06 18:50:10.0

Updated: 2018-05-24 14:39:29.0

Pushed: 2018-05-23 16:43:17.0

Homepage: null

Size: 17

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

GUS API

G eoJSON
U r
S preadsheet
:smile:

API for converting a Google Spreadsheet into a GeoJSON object. Inspired by the GUS map project, but made to be a more generic tool to enable any type of map rendering library. Have a look at the example spreadsheet and an example request to the API.

Prepare your spreadsheet

The main endpoint is GET /{spreadsheet id} which gets your Google Spreadsheet and converts it into a GeoJSON response.

Spreadsheet structure

The format of your spreadsheet requires the first row to be headers and two columns representing longitude and latitude. Each of these columns must be in WGS84 coordinates and can only represent points. The name of these columns MUST match the following formats:

Publish your spreadsheet

In order to make the spreadsheet available to the API, you must “publish to the web” by selecting File > Publish to the web... > Press Publish. This will make your spreadsheet publicly available. Once this is complete, grab the ID of the spreadsheet in the URL. It will look similar to this 1ctA2wUBHGjrBRhQlma_x2Q5oRsC5L85XALfhkezsQMY. Use this ID to pass into the following endpoint

Usage

The conversion can happen in three ways:

API

Use the following URL to make a request (replace {id} with your spreadsheet ID)

s://e53r0f186h.execute-api.us-west-2.amazonaws.com/production/{id}

You'll see four possible responses:

Node.js module

Install the module

install gus-api

Require it

t toGeojson = require('gus-api').toGeojson;
t spreadsheetID = 'my-id';

ojson(id, (err, geojson) => {
 ...

Copy and paste

Or just copy and paste the toGeojson function directly from index.js!

Develop

GUS API is deployed with AWS API Gateway and a Lambda Proxy. If you have the proper development keys, make your changes and commit, and deploy the code by running npm run deploy which will install node modules using the --production flag and zip up the directory to save on AWS s3 for the lambda to use.

Test
test

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.