Skip to content

Instantly share code, notes, and snippets.

mojodna / bbox.sql
Created Feb 1, 2017
Find all nodes, ways, and relations in a bounding box (AWS Athena + OSM ORC).
View bbox.sql
with params as (
27.61649608612061 as minlon,
53.85379229563698 as minlat,
27.671985626220707 as maxlon,
53.886459293813054 as maxlat
), direct_nodes as (
select, n.version, n.changeset, n.timestamp,, n.lon
planet n,
View gist:dac599b2c69a1958ececf3de42ceb358
IFS="\n"; for line in $(grep JPG 2016_06_08_fluff4_geoinfo.txt); do echo $line | awk '{print "exiftool " $1 " -exif:gpslatitude=" $2 " -exif:gpslatituderef=S -exif:gpslongitude=" $3 " -exif:gpslongituderef=W -exif:gpsaltitude=" $4}'; done >; IFS=
mojodna /
Created Aug 30, 2016
Get the closest web mercator zoom for a raster input
import math
import sys
import rasterio
from rasterio.warp import (calculate_default_transform, transform)
mojodna /
Created Jun 30, 2016
Polygonize landcover block-by-block.
from __future__ import print_function
import json
import sys
import fiona
from import from_epsg
import rasterio
from rasterio import features
mojodna /
Last active Sep 7, 2016
TileMill in bash + AppleScript

TileMill in bash + AppleScript

Installation (OS X)

In the project directory:

npm install tessera tilelive-mapnik tilelive-carto
brew install fswatch
mojodna /
Last active May 14, 2017
Chunk out NED ⅓arc second data using pyspark

To run this on EMR, do something akin to the following (with buckets changed as appropriate):

aws emr create-cluster \
  --name "NED Conversion" \
  --log-uri s3:// \
  --release-label emr-4.0.0 \
  --use-default-roles \
  --auto-terminate \
  --ec2-attributes KeyName=stamen-keypair \
mojodna /
Last active Apr 15, 2020
GDAL 2.0 on Amazon Linux
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 | tar zxf -
cd gdal-2.0.0/
./configure --prefix=/usr/local --without-python
make -j4
sudo make install
View osm.xml
<Service name="TMS">
View dynamodb-batch-get.js
"use strict";
var AWS = require("aws-sdk");
region: process.env.AWS_DEFAULT_REGION || AWS.config.region || "us-east-1"
var dynamodb = new AWS.DynamoDB();
mojodna / queue_srtm.js
Created Apr 25, 2015
Vapor clock feeder
View queue_srtm.js
#!/usr/bin/env node
/* eslint-disable no-sync */
"use strict";
var assert = require("assert"),
fs = require("fs"),
path = require("path"),
util = require("util");
var env = require("require-env"),
You can’t perform that action at this time.