This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
COPY | |
( | |
SELECT row_to_json(fc) AS json_out | |
FROM ( | |
SELECT 'FeatureCollection' AS type, | |
array_to_json(array_agg(f)) AS features | |
FROM ( | |
SELECT 'Feature' AS type, | |
st_asgeojson(st_transform(st_union(geom), 4326))::json AS geometry | |
FROM ne_10m_admin_0_countries |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ReactMapGL | |
{...props.state.viewport} | |
width="100%" | |
height="100%" | |
mapStyle={state.mapStyle} | |
onViewportChange={_onViewportChange} | |
dragRotate={false} | |
mapboxApiAccessToken={process.env.REACT_APP_MAPBOX_TOKEN} | |
onHover={_onHover} | |
onClick={_onMouseClick} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as turf from '@turf/turf'; | |
// Create a FeatureCollection from all of the resources | |
const featureCollection = turf.featureCollection(resources.features); | |
// Get the lat/long of the selected feature | |
const point = turf.point(rows.length ? rows[0]?.geometry?.coordinates : [0, 0]); | |
// Create a 50-mile buffer around the selected point | |
const buffered = turf.buffer(point, 50, { units: 'miles' }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
import ReactMapGL, { Layer, Source } from 'react-map-gl'; | |
import { useEffect, useRef, useState } from 'react'; | |
import { DATA_PROPERTY, LAYER_PROPERTIES, FILL_COLOR_PAINT, SELECTED_LAYER } from '../../constants'; | |
import { makeStyles } from '@material-ui/core/styles'; | |
const useStyles = makeStyles((theme) => ({ | |
map: { | |
width: '100%', | |
height: '100%', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ...retrieve data from current and previous data sets - http://data.diversitydatakids.org [great API for census level data] | |
# ...and match current w/ previous census tract ids | |
# Drop table and view before starting | |
DROP | |
VIEW IF EXISTS clipped_census_tracts_with_all_data; | |
DROP | |
TABLE IF EXISTS census_tract_with_all_data_points; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ReactMapGL | |
... | |
mapStyle="mapbox://styles/graphicacy/<style_id>>" | |
mapboxApiAccessToken={ACCESS_TOKEN} | |
> | |
<Source id={LAYER_NAME} type="vector" url="mapbox://graphicacy.<dataset_id>" /> | |
<Layer | |
type="fill" | |
id="fill_layer" | |
source={LAYER_NAME} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
####### | |
# Note: | |
# This OS X tested script assumes you have a PostGIS-enabled database named gis_db | |
# and the command line tool shp2pgsql installed. | |
####### | |
# Easiest to begin inside the /Downloads directory | |
cd ~/Downloads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const { GoogleSpreadsheet } = require('google-spreadsheet'); | |
const middy = require('middy'); | |
const { cors } = require('middy/middlewares'); | |
const { to } = require('await-to-js'); | |
const moment = require('moment'); | |
const data = require('./primarycast-sheets.json'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd ~/Downloads | |
# Go through each state FIPs code and get their places SHP file | |
StateFIPS=( | |
"01" "02" "04" "05" "06" "08" "09" "10" | |
"11" "12" "13" "15" "16" "17" "18" "19" | |
"20" "21" "22" "23" "24" "25" "26" "27" | |
"28" "29" "30" "31" "32" "33" "34" "35" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy a React application to GitHub-Pages | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build-and-deploy-to-gh-pages: | |
runs-on: ubuntu-latest |