Skip to content

Instantly share code, notes, and snippets.

View nickpeihl's full-sized avatar

Nick Peihl nickpeihl

View GitHub Profile
@nickpeihl
nickpeihl / index.js
Created February 13, 2017 03:40
Leaflet with Nanocomponent
var component = require('nanocomponent')
var L = require('leaflet')
var html = require('bel')
var css = require('sheetify')
css('leaflet')
var map
var MapEl = component({
placeholder: function () {
@nickpeihl
nickpeihl / index.html
Last active November 20, 2019 09:48
GeoForm Leaflet Style
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Geo Form Leaflet</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="stylesheet" href="https://unpkg.com/tachyons/css/tachyons.min.css">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.2/dist/leaflet.css">
</head>
<body>
@nickpeihl
nickpeihl / index.js
Last active January 19, 2017 23:32
Parse messy time example
var parse = require('parse-messy-time')
var input = document.createElement('input')
input.setAttribute('type', 'text')
input.setAttribute('value', 'last sunday at 6pm')
var output = document.createElement('p')
var btn = document.createElement('input')
btn.setAttribute('type', 'button')
@nickpeihl
nickpeihl / index.js
Created January 13, 2017 22:45
Example of Streaming Esri JSON to GeoJSON
const request = require('request')
const JSONStream = require('JSONStream')
const TerraformerArcGIS = require('terraformer-arcgis-parser')
const geojsonStream = require('geojson-stream')
const fs = require('fs')
const url = 'http://sjcgis.org/arcgis/rest/services/Polaris/Buildings/MapServer/0/query?outSR=4326&where=FID >= 20000 AND FID<=20175&f=json&outFields=*&geometry=&returnGeometry=true&geometryPrecision=10'
const featureStream = JSONStream.parse('features.*', convert)
const outFile = fs.createWriteStream('features.geojson')
@nickpeihl
nickpeihl / index.js
Last active October 18, 2016 00:04
Just playing with WA voter registration database
const csv2 = require('csv2')
const filter = require('through2-filter')
const map = require('through2-map')
const fs = require('fs')
const ws = fs.createWriteStream('sjc.csv')
const rs = fs.createReadStream('201609_VRDB_Extract.txt')
const parser = csv2({
separator: ' '
@nickpeihl
nickpeihl / current_use.html
Created September 11, 2016 04:37
Current Use Taxation in San Juan County (unfinished)
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.23.0/mapbox-gl.js'></script>
<script src='https://npmcdn.com/simple-statistics@2.0.0/dist/simple-statistics.min.js'></script>
<script src="https://d3js.org/d3-color.v1.min.js"></script>
<script src="https://d3js.org/d3-interpolate.v1.min.js"></script>
@nickpeihl
nickpeihl / index.html
Created September 2, 2016 00:02
Polygon pop-ups on click using Open Data from San Juan County WA and Mapbox-GL.js
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.23.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.23.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@nickpeihl
nickpeihl / index.html
Created September 2, 2016 00:01
Raster map tiles using Open Data from San Juan County WA and Mapbox-GL.js
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.23.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.23.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@nickpeihl
nickpeihl / index.html
Created September 2, 2016 00:00
Heatmap example using Open Data from San Juan County WA and Mapbox-GL.js
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.23.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.23.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@nickpeihl
nickpeihl / index.html
Created September 1, 2016 23:59
Clustering example using Open Data from San Juan County WA
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.23.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.23.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }