Skip to content

Instantly share code, notes, and snippets.

View joeyklee's full-sized avatar

Joey Lee joeyklee

View GitHub Profile

Keybase proof

I hereby claim:

  • I am joeyklee on github.
  • I am joeyklee (https://keybase.io/joeyklee) on keybase.
  • I have a public key whose fingerprint is 9065 5F5E 9DF4 51F6 3BA4 E8D3 C538 FC9D 5FD2 CF74

To claim this, I am signing this object:

@joeyklee
joeyklee / index.html
Created November 28, 2016 16:59
Stamen Raster tiles in Mapboxgl.js - based on https://bl.ocks.org/danswick/a4de5c170c04fdd38bb4
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.11.4/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.11.4/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@joeyklee
joeyklee / overpass-query-buildings.txt
Created January 10, 2017 16:04
Query: Overpass-turbo Buildings
<!--
This has been generated by the overpass-turbo wizard.
Gets back buildings
-->
<osm-script output="json" timeout="25">
<!-- gather results -->
<union>
<!-- query part for: “building” -->
<query type="way">
<has-kv k="building"/>
@joeyklee
joeyklee / overpass-query-transit-stops.txt
Created January 10, 2017 16:09
Query: overpass-turbo bus stops
<!--
This has been generated by the overpass-turbo wizard.
The original search was:
“highway=bus_stop”
from: http://overpass-turbo.eu/?q=PCEtLQpUaGlzIGhhxIhiZWVuIGfEj2VyYXRlZCBieSB0aGUgb3bElHDEi3MtdHVyYm8gd2l6YXJkLsSExJ_EoXJpZ2luYWwgc2XEsmNoxK7EizoKw6LCgMKcxIZnaHdheT1idXNfc3RvcMWKwp0KxII-Cjxvc20tc2PEuXB0xKF1dHDFrT0ianNvbiLEnWltZW_FsCIyNSLFoCAgxIDEgsSRxJbEn3IgcmVzdWx0xIjFnwrGgzx1bmnFtcaCxoPGhMSBLSBxdcSUxJzEpXLFq2ZvcjogxYrFjMS6xY_FkcWTxZXFl8WZxZvCgMKdIMaTxpzGhMahxqPEnXlwZcWxbm9kZcaBxpTGu8aExIrEp2t2IGvFscWNxrB5xbd2xbHFlMWWxZjFmiIvxpvGuzxixKx4Lca9csSce3vHom94fX3HnseJxpUvx6Z5x5_GvMaix6fGv8eBx4PHhceHx7bGlceMLceOx5DFscWvYmxpY190xJVuc3DGqXTHlsWxx5twX8iQc2l0xpnFtsewx4rGhMerx6THtCDHqcihx67InseKPMezx7jHtcexyKnIo3THgMeCIseEx4bHiMifPMiByIPHkSLIhsiIyIrIjGHIjsiQxqbIk8i9bMSWxqhybcedx7_IoMejx6XIrMikx6rHo8inyY7Iqse0yY7GlciwyLLFscWQx5XJl8i6x4_IvMi-yInIi8iNyI_IkcmGcMmIdMmKyYzIqMegyKHJkca-yKXJlcevyZfIq8ajxaDHiciqxpfInMabxoXGn3DEuW7Fq8aMxo7GkMaSLcqByoTEvMWrbce9x5jHhceVyKg8xoxjxKrFgce6yLNkb3fIncqNyoXKkMqSInNrZWxlxZnFtsS4x4ZyxbHGoWF
@joeyklee
joeyklee / ogr2ogr-terminal-reprojection.txt
Created January 13, 2017 09:29
ogr2ogr reprojection
# single projection change
ogr2ogr output.shp -t_srs "EPSG:4326" input.shp
# loop all shpfiles in folder
for shp in *.shp
do
echo “Processing $shp”
projection="utm10n_"
ogr2ogr -s_srs EPSG:4326 -t_srs EPSG:26910 $projection$shp $shp
done
@joeyklee
joeyklee / getAngleDeg.js
Created January 13, 2017 09:33
Get the angle in degrees from two points
function getAngleDeg(p1, p2){
// returns the angle between 2 points in degrees
// p1 = {x: 1, y: 2};
// p2 = {x: 3, y: 4};
return Math.atan2(p2.y - p1.y, p2.x - p1.x) * 180 / Math.PI;
}
@joeyklee
joeyklee / getAngleRad.js
Created January 13, 2017 09:33
Get the angle in radians between two points
function getAngleRad(p1, p2){
// returns the angle between 2 points in radians
// p1 = {x: 1, y: 2};
// p2 = {x: 3, y: 4};
return Math.atan2(p2.y - p1.y, p2.x - p1.x);
}
@joeyklee
joeyklee / getAngleDeg.pde
Created January 13, 2017 09:35
Get angle in degrees between two points in Processing
float getAngle(float pX1,float pY1, float pX2,float pY2){
return atan2(pY2 - pY1, pX2 - pX1)* 180/ PI;
}
@joeyklee
joeyklee / ogr2ogr-batch-convert-and-merge2one.py
Created January 27, 2017 13:53
python script to batch convert xml to shp and then combine all the shps to one
import sys
import os
import subprocess
import shutil
def main():
xmls = [ f for f in os.listdir(ifolder) if f[-4:] == ".xml"]
# print xmls[1][:-4]
@joeyklee
joeyklee / transect_epicc2sp_woss.geojson
Created February 21, 2017 19:32
the transect used in https://github.com/diysco2/analysis. note coords are in UTM 10N
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.