Skip to content

Instantly share code, notes, and snippets.

@aaronpdennis
aaronpdennis / gist:5ce5198f7b5a73d64920
Created June 23, 2015 18:54
create topojson file
topojson \
-o ../site/countries_topo.json \
-p \
-- countries.json
@aaronpdennis
aaronpdennis / countries.json
Created June 30, 2015 16:04
countries names with ISO3, world regions, and ARC regions
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aaronpdennis
aaronpdennis / gist:35958e66970a9f1787aa
Last active August 29, 2015 14:24
generate hdm mbtiles
tippecanoe \
-z 14 -Z 13 \
-d12 -D12 \
-b 20 \
-pc -f \
-o hdm.mbtiles \
hdm-data/hdm_label.json\
hdm-data/water_source.json \
hdm-data/communication.json \
hdm-data/electric_utility.json \
@aaronpdennis
aaronpdennis / hdm.json
Last active September 2, 2017 02:45
Process for inputing OpenStreetMap .pbf files, generating vector tiles based off a humanitarian data model, and then hosting those tiles as a data source on Mapbox.
{
"water_source": {
"class": {
"water well": ["man_made=water_well"],
"water tower": ["man_made=water_tower"],
"water tank": ["man_made=storage_tank", "man_made=water_tank"],
"spring": ["natural=spring"],
"drinking water": ["amenity=drinking_water"]
},
"potable": {
tippecanoe -z 9 -f -o ../hex-tiles.mbtiles ./data/grid-agg.geojson
@aaronpdennis
aaronpdennis / gist:4e48c27223fe6885022d
Last active August 29, 2015 14:26
streaming blood type donations to tippecanoe
node blood-type-donors-map.js ./data/blood_drives_verified.geojson | tippecanoe -f -z 8 -b 12 -r 2.0 -o ../blood_types.mbtiles
@aaronpdennis
aaronpdennis / README.md
Last active December 14, 2016 02:28
Processing Planet.osm and serving HDM vector tiles.

Building and Updating a Global HDM Vector Tile Source from OSM Data

The Mapbox Studio style hdm-style.tm2 is a humanitarian map design that relies on three vector tile sources, two of which are hosted and served by Mapbox:

  1. Mapbox Streets
  2. Mapbox Terrain
  3. Humanitarian Data Model vector tiles

The third source is the focus of this writeup. Currently, hdm-style.tm2 uses a hand-processed, non-updating snapshot of HDM vector tiles for small subregions of the world. This gist explains in rough psuedocode and theory how you could set up a HDM vector tiles source that would update hourly (or minutely or daily) from the OSM database and cover the entire planet.

#!/usr/bin/env node
var fs = require('fs');
var osmium = require('osmium');
var turf = require('turf');
var Cardboard = require('cardboard');
var cardboard = Cardboard({
table: 'hdm-vt-table',
region: 'us-east-1',