Skip to content

Instantly share code, notes, and snippets.

@jeremiak
jeremiak / determine-rgb-values-for-polygons.mjs
Created November 28, 2022 20:25
Script used to reconstitute RGB values across polygons
import { writeFile } from "fs/promises";
import intersect from "@turf/intersect";
import polygon1 from "./polygon-1-clipped.json" assert { type: "json" };
import polygon2 from "./polygon-2-clipped.json" assert { type: "json" };
import polygon3 from "./polygon-3-clipped.json" assert { type: "json" };
const intersected = [];
polygon1.features.forEach((polygon1Feature) => {
We can't make this file beautiful and searchable because it's too large.
country,region,year,population,income_per_person,life_expectancy
Afghanistan,asia,1799,3280000,60,28.2
Afghanistan,asia,1800,3280000,60,28.2
Afghanistan,asia,1801,3280000,60,28.2
Afghanistan,asia,1802,3280000,60,28.2
Afghanistan,asia,1803,3280000,60,28.2
Afghanistan,asia,1804,3280000,60,28.2
Afghanistan,asia,1805,3280000,60,28.1
Afghanistan,asia,1806,3280000,60,28.1
Afghanistan,asia,1807,3280000,60,28.1
@jeremiak
jeremiak / Makefile
Last active February 12, 2021 01:17
Quickly create a Mapbox vector tileset for the world's oceans
ne_10m_ocean.zip:
wget https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/physical/ne_10m_ocean.zip
shapefile: ne_10m_ocean.zip
unzip -d shapefile -o ne_10m_ocean.zip
ocean.geojson: shapefile
npx mapshaper -i shapefile/ne_10m_ocean.shp -o ocean.geojson
ocean.mbtiles: ocean.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
We couldn’t find that file to show.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
[
{
"time": "Tue, 07 Aug 2018 21:33:04 GMT",
"counties": [
{
"name": "Delaware",
"fips": "39041",
"precincts_total": 159,
"reported_total": 0,
"reported_percent": 0
<template lang="html">
<div
id="topbar"
vff-template="Topbar"
:style="{backgroundColor: backgroundColor, color: textColor}"
>
<router-link
:to="{name: 'ElectionDay', params: { officeProp: office, day: day }, query: {primaryParty: party}}"
tag="div"
class="topbar-bg" />