View split-shapefile.py
#!/usr/bin/env python
import logging
from optparse import OptionParser
import os
import mercantile
import subprocess
def split_file(source_path, dest_dir, zoom, mercator=False):
for x in range(0, pow(2, zoom)):
View contour_workflow.md

This document is a work in progress, and outlines my new workflow for generating contour lines.

Prep:

Load metadata for all available DEMs into into postgis. More on this later.

Prepare coastline data

Goal of this step is to get a series of polygons that can be used for intersection queries to determine if a contour is adjacent to the coastline.

Download OSM coastlines wget http://data.openstreetmapdata.com/coastlines-split-3857.zip

View macSetup.sh
#!/bin/bash
[ $SHLVL = 2 ] && echo "Usage: . ${0##*/}" && exit
VIRTUALENVNAME=contours
if [ ! -d ~/python/$VIRTUALENVNAME ]
then
test -e ~/python || mkdir ~/python
pushd .
cd ~/python
View background.xml
<GDAL_WMS>
<Service name="TMS">
<ServerUrl>http://otile1.mqcdn.com/tiles/1.0.0/sat/${z}/${x}/${y}.png</ServerUrl>
</Service>
<DataWindow>
<UpperLeftX>-20037508.34</UpperLeftX>
<UpperLeftY>20037508.34</UpperLeftY>
<LowerRightX>20037508.34</LowerRightX>
<LowerRightY>-20037508.34</LowerRightY>
<TileLevel>18</TileLevel>
View ViewController.m
//
// file existance test
//
// Created by Jesse Crocker on 2/27/14.
//
#import "ViewController.h"
@interface ViewController ()
View mvt-tile-info.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# By Jesse Crocker
# Convert mapnik vector tiles to geojson
# Based on https://github.com/mapbox/mapnik-vector-tile/blob/master/python/renderer.py
from __future__ import print_function
import sys
View S3DownloadStatus.java
package com.trailbehind.downloads;
import android.util.Log;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.GetObjectMetadataRequest;
import com.amazonaws.services.s3.model.GetObjectRequest;
import com.amazonaws.services.s3.model.ObjectMetadata;
import com.amazonaws.services.s3.model.S3Object;
import com.crashlytics.android.Crashlytics;
View RMProjection.h
//
// RMProjection.h
//
// Copyright (c) 2008-2009, Route-Me Contributors
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this
View average-file-size
#!/bin/bash
if [ $# -eq 0 ]
then
DIR=`pwd`
else
DIR=$1
fi
echo Directory $DIR
find -x $DIR -type f -exec sh -c 'stat -f '%z' "${@}"' _ '{}' + |
View gdal_rounded_extent.py
#!/usr/bin/env python
from osgeo import gdal, ogr, osr
import sys
import logging
from optparse import OptionParser
import os
gdal.UseExceptions()