lesniakania / be_impactful

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Be Impactful

A map widget for Impact Working Group #omgkrk

Development

Create .env file with MAPBOX_ACCESS_TOKEN=token

npm install
npm start

Production

npm run build

You should have now main.[hash].js in the ./dist directory.

You can use a widget in any html page like that:

<script src="path-to-generated-main-js-bundle"></script>

Or you can deploy example to Github Pages:

npm run deploy

How to feed widget with data

  1. Generate geojson file using csv file. Data needed: id, latitude, longitude
npm run generate-geojson ~/path-to-the.csv

Generated geojson file should be in ./data directory.

  1. Upload geojson to the Mapbox Studio as dataset.
  2. Create a tileset from this dataset.
  3. Add a layer with this tileset/dataset in the custom style.
  4. Update ./src/Config.js - style, sourceLayer (dataset name), layerName (layer name you added to the style)
  5. Make sure that you use correct accessToken (placed in .env as MAPBOX_ACCESS_TOKEN=token)

About


Languages

Language:JavaScript 86.1%Language:CSS 11.2%Language:HTML 2.7%