Skip to content

Instantly share code, notes, and snippets.

View clhenrick's full-sized avatar

Chris Henrick clhenrick

View GitHub Profile
@fokusferit
fokusferit / enzyme_render_diffs.md
Last active April 23, 2025 17:13
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@benelsen
benelsen / proj.rb
Last active May 16, 2017 20:41
Winkel-Tripel with GDAL2

Requires gdal2:

brew install osgeo/osgeo4mac/gdal2
export PATH="/usr/local/opt/gdal2/bin:$PATH" # or just use /usr/local/opt/gdal2/bin/gdalwarp

And a build of bleeding-edge version of proj:

brew reinstall proj.rb --HEAD
@mbostock
mbostock / .block
Last active January 16, 2020 12:46
GeoTIFF Contours
license: gpl-3.0
height: 481
redirect: https://observablehq.com/@d3/geotiff-contours
@johan
johan / Makefile
Created January 24, 2017 06:15
Makefile of the steps in Mike Bostock's command-line cartography tutorial, parts 1-4 https://medium.com/@mbostock/command-line-cartography-part-1-897aa8f8ca2c
# request one at http://api.census.gov/data/key_signup.html and paste it below
CENSUS_API_KEY=YOUR_CODE_HERE
# a factor 1609.34 squared
SQ_M_TO_SQ_MI=2589975.2356
#prereqs:
# npm install -g shapefile # 0.6.1
# npm install -g d3-geo-projection # 1.2.1
# npm install -g ndjson-cli # 0.3.0
@mbostock
mbostock / .block
Last active April 8, 2023 19:39
Versor Dragging
license: gpl-3.0
height: 600
border: no
redirect: https://observablehq.com/@d3/d3-versor-dragging
@jsanz
jsanz / README.md
Last active February 10, 2017 21:53
CARTO: Aggregating data on SQL and infowindows

CARTO: Aggregating data on SQL and infowindows

Example on how to aggregate data using spatial SQL and then show the also attributes on CARTO BUILDER infowindow.

Based on a sample dataset with images I will first reduce the geographical precission so they collide into a grid. After that using the json_agg function we join the urls into a single field along with the counts.

WITH data as (
@jsanz
jsanz / README.md
Last active February 10, 2017 22:01
JavaScritpt: bind event to custom infowindow visibility change in carto.js

On this simple carto.js example we add a custom infowindow using Mustache and bind to its model an event when the change:visibility property changes.

Open the console for the Hi! and Bye! messages when showing and closing an infowindow.

@veltman
veltman / README.md
Created October 10, 2016 16:08
Geosupport w/ JS and node-ffi

Geocoding 10,000 addresses a second with NYC's Geosupport library and Node FFI

Following on Chris Whong's excellent writeup of how to make calls directly to NYC's Geosupport client and this first attempt at generalizing it, here's a way that let me geocode about 10,000 addresses a second on Ubuntu using Node FFI.

Note: this assumes Ubuntu - other Linux is probably fine but may need adjustments.

First, install the basics:

# Update, install Node and unzip (if needed)

#Using NYC geospport linux shared library from Ubuntu 16.04

I have been trying to understand more about geosupport, specifically geosupport desktop edition for linux which contains a linux .so shared library. I would like to eventually write node.js bindings for it so that I can write geocoding scripts that don't require a ton of network traffic.

I am a C noob and this was my first time messing with C and gcc on linux. I was able to write and compile a simple C program that calls the Geosupport shared library with hard-coded arguments.

##What is geosupport?

"Geosupport is a data processing system originally designed to run on IBM mainframes to support geographic processing needs common to New York City agencies." Basically, it's an NYC-specific geocoder released by the NYC department of city planning. It does many things, but at its simplest it can take human-readable address fields and return a point coordinate.

@jsanz
jsanz / README.md
Created September 14, 2016 09:23
SQL: ring buffers with several distances

Query to produce a series of rings using buffers:

  • First you get a generate_series with the number of rings you want to produce
  • Then produce the 80km buffers multiplying by the radius for a number of cities
  • Finally use the lag function to remove for every ring the previous one so you get the ring