All Projects → jlord → gs2geojson

jlord / gs2geojson

Licence: other
Make geoJSON from Google Spreedsheets

Programming Languages

javascript
184084 projects - #8 most used programming language

Make geoJSON

More specifically, make geoJSON from a Google spreadsheet because you can view that in a beautiful Mapbox map on GitHub. YEAH!

This is a super simple node.js command line tool (NPM) that fetches your data from Google Spreadsheets and transforms it to geoJSON with the option to write it to a file. When you push the file to GitHub after running the script, you can view it in your repo as a lovely map!

Quick How

  1. npm install -g gs2geojson
  2. Have a Google Spreadsheet with lat, long columns and if you want, a hexcolor column. Publish spreadsheet, copy key.
  3. gs2geojson YOURSPREADSHEETKEY
  4. Use gs2geojson YOURSPREADSHEETKEY --save to write it to a file to push to GitHub

See directly below if you want to know more about getting lat and long

Long How

Make a Spreadsheet

spreadsheet

  1. Your spreadsheet should have a lat column and long column. You can do it manually or use this Mapbox Plugin or use a Geocoder.
  2. If you want to pick your own markers colors, and a column titled hexcolor with the hexcolor values you want. The default is blue.
  3. Click File > Publish to the Web > Start Publishing. Copy the key generated between the = and &:

get spreadsheet key

Node and NPM

  1. You'll need to have Node.js and NPM installed on your computer.
  1. In your computer's Terminal, type npm install -g gs2geojson to install it as a global module.
  2. Here's an example you can try: gs2geojson 0Ao5u1U6KYND7dGN5QngweVJUWE16bTRob0d2a3dCbnc --save

Additionally, if you want to clone this repo, you can cd gs2geojson and run npm install then npm test to try it out.

Add Your Key and Run

  1. In your Terminal type gs2geojson YOURSPREADSHEETKEY
  • If you want to save the spreadsheet as a geojson file in the directory you're in type gs2geojson YOURSPREADSHEETKEY --save
  • To pipe the data to you clipboard to paste somewhere else type gs2geojson YOURSPREADSHEETKEY | pbcopy

Push to GitHub and View

  1. Include it in a repo and push it to GitHub!
  2. Go look at it on the internet!
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].