Skip to content

Instantly share code, notes, and snippets.

@mojodna
mojodna / 0_register_planet.sql
Last active Jun 17, 2020
Sample OSM Athena queries
View 0_register_planet.sql
--
-- This will register the "planet" table within your AWS account
--
CREATE EXTERNAL TABLE planet (
id BIGINT,
type STRING,
tags MAP<STRING,STRING>,
lat DECIMAL(9,7),
lon DECIMAL(10,7),
nds ARRAY<STRUCT<ref: BIGINT>>,
View dynamodb-batch-get.js
"use strict";
var AWS = require("aws-sdk");
AWS.config.update({
region: process.env.AWS_DEFAULT_REGION || AWS.config.region || "us-east-1"
});
var dynamodb = new AWS.DynamoDB();
View git-svn-diff.sh
#!/bin/bash
#
# git-svn-diff originally by (http://mojodna.net/2009/02/24/my-work-git-workflow.html)
# modified by mike@mikepearce.net
# modified by aconway@[redacted] - handle diffs that introduce new files
#
# Generate an SVN-compatible diff against the tip of the tracking branch
# Get the tracking branch (if we're on a branch)
TRACKING_BRANCH=`git svn info | grep URL | sed -e 's/.*\/branches\///'`
@mojodna
mojodna / README.md
Last active Apr 15, 2020
GDAL 2.0 on Amazon Linux
View README.md
sudo yum -y update
sudo yum-config-manager --enable epel
sudo yum -y install make automake gcc gcc-c++ libcurl-devel proj-devel geos-devel
cd /tmp
curl -L http://download.osgeo.org/gdal/2.0.0/gdal-2.0.0.tar.gz | tar zxf -
cd gdal-2.0.0/
./configure --prefix=/usr/local --without-python
make -j4
sudo make install
@mojodna
mojodna / typography.yaml
Created Dec 3, 2018
Tangram style (modified from Refill) pushing the type layout engine
View typography.yaml
# Refill provides a high contrast, black & white basemap useful for data visualization.
# Give OpenStreetMap data a professional basemap skin using the Tangram graphics library
# and Mapzen's versatile Vector Tiles.
#
# Refill is a modern GL take on Geraldine's work on Toner for Stamen as part of their
# great CityTracking project. Please use and adapt the open source scene file in
# your own projects!
#
# Authors: Geraldine Sarmiento, Nathaniel V. Kelso
# Read more: https://github.com/tangrams/refill-style
@mojodna
mojodna / Procfile
Created Sep 29, 2011 — forked from RandomEtc/Procfile
Getting Kue working on Heroku
View Procfile
web: node app.js
worker: node consumer.js
@mojodna
mojodna / NOTES.md
Last active May 20, 2019
libvirt LXC container w/ bridged networking (and 2GB RAM)
View NOTES.md

https://wiki.ubuntu.com/SergeHallyn_libvirtlxc

apt-get install -y libvirt-bin lxc
lxc-create -t ubuntu -n o1
wget http://people.canonical.com/~serge/o1.xml
virsh -c lxc:// define o1.xml
virsh -c lxc:// start o1
virsh -c lxc:// console o1
@mojodna
mojodna / README.md
Last active Oct 26, 2018
ESACCI-LC Mid Latitude mask
View README.md

Mid Latitude masking

First, apply the mid latitude mask as mask.

Next, add envelopes for each of the C-CAP sources as masks (otherwise chunky pixels sneak in, per https://github.com/mojodna/marblecutter-land-cover/issues/6):

update land_cover set mask = ST_Union(mask, (select ST_Union(ST_Envelope(geom)) from land_cover where source='C-CAP')) where source='ESACCI-LC Mid Latitudes';
@mojodna
mojodna / README.md
Created Oct 26, 2018
ESACCI-LC Mid Latitude mask
View README.md
-- update the footprint to exclude the mask
update land_cover set geom=ST_Multi(ST_Difference(geom, mask)) where source='ESACCI-LC Mid Latitudes';
@mojodna
mojodna / index.html
Last active Oct 3, 2018
Mapping of Detroit by month
View index.html
<!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.45.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.45.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
You can’t perform that action at this time.