Skip to content

Instantly share code, notes, and snippets.

View MateoV's full-sized avatar

Matt Greene MateoV

  • West Bloomfield, MI
View GitHub Profile
import json
import mercantile
output = {}
output['type'] = 'FeatureCollection'
output['features'] = []
with open('testlist', 'r') as f:
for line in f:
x = int(line.split('-')[1])

Ingredients

intended for a 3L jar

  • 3 pounds pickling cucumbers, such as Kirby, scrubbed
  • 6 cups water
  • 1/2 cup distilled white vinegar + enough to top off jar (usually ~1/4 cup)
  • 1/4 cup coarse kosher salt
  • 1/2 - 1 head of garlic (smashed whole cloves)
  • 1 bunch fresh dill
var turf = require('turf');
var my_poly = {"type":"Feature","geometry":{"type":"MultiPolygon","coordinates":[[[[10.180206298828125,52.77701641822032],[10.180206298828125,52.82351239964272],[10.180206298828125,52.84508292433087],[10.182952880859375,52.8732743724185],[10.257110595703125,52.894820182985136],[10.369720458984375,52.906417338833315],[10.504302978515625,52.906417338833315],[10.526275634765625,52.89979077269751],[10.542755126953125,52.894820182985136],[10.545501708984375,52.89316319305443],[10.545501708984375,52.80857268383112],[10.545501708984375,52.76372272054047],[10.542755126953125,52.6772147136293],[10.542755126953125,52.658892951388836],[10.542755126953125,52.65056233801667],[10.542755126953125,52.58219141858192],[10.542755126953125,52.55047112092798],[10.537261962890625,52.48696168541221],[10.443878173828125,52.48361654018387],[10.443878173828125,52.51371369009507],[10.446624755859375,52.57885352016413],[10.446624755859375,52.595540470772505],[10.449371337890625,52.603881563601846],[10.454864
@MateoV
MateoV / difference.js
Created August 4, 2015 19:18
Use Tile Reduce and OSM QA Tiles to find the difference between OSM roads and Tiger roads
var turf = require('turf'),
flatten = require('geojson-flatten'),
normalize = require('geojson-normalize'),
tilebelt = require('tilebelt');
module.exports = function(tileLayers, tile, done) {
// concat feature classes and normalize data
var tigerRoads = normalize(tileLayers.tiger.tiger20062014);
var osmData = normalize(tileLayers.osmdata.migeojson);
@MateoV
MateoV / disconnect.js
Last active May 20, 2016 05:58
Use Tile Reduce and OSM QA Tiles to find gaps in road networks
//identify disconnected major roads
var turf = require('turf');
var tilebelt = require('tilebelt');
var flatten = require('geojson-flatten');
module.exports = function(tileLayers, tile, done){
var bbox = tilebelt.tileToBBOX(tile);
var minDistance = 50/5280; // 50 ft in miles
var disconnects = turf.featurecollection([]);
var caps = [];
@MateoV
MateoV / enable-coredumps.sh
Created June 11, 2015 21:28
How to enable coredumps on an EC2
sudo su
echo "core.%e.%p.%h.%t" > /proc/sys/kernel/core_pattern
ulimit -c unlimited
@MateoV
MateoV / index.js
Created May 8, 2015 21:31
tile-reduce w/ throttle
var EventEmitter = require("events").EventEmitter;
var cover = require('tile-cover');
var tilebelt = require('tilebelt');
var turf = require('turf');
var browserify = require('browserify');
var exec = require('child_process').execSync;
var fork = require('child_process').fork;
var cpus = require('os').cpus().length;
var rateLimit = require("rate-limit");
SELECT *,
CASE WHEN (select fid from water where st_contains(water.geom, sub.geom)) IS NOT NULL
THEN 1 ELSE 0 END AS maritime
FROM ((
SELECT (boundary_split.boundary).geom, $way_id*(boundary_split.boundary).path[1] as osm_id, $disputed as disputed
FROM
(SELECT
st_dump(st_split($way_geom, st_linemerge(geom))) AS boundary
FROM
(SELECT geom FROM coastline WHERE st_intersects(geom, $way_geom)) AS coast) AS boundary_split
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MateoV
MateoV / split.sh
Created February 4, 2014 19:32
Script to split a Mexico 15m DEM file into smaller chunks
#!/bin/bash
set -e -u
width=218763
height=130943
y=0
while [ $y -lt $height ]
do
x=0
while [ $x -lt $width ]