This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://en.wikipedia.org/wiki/Gaussian_function | |
const [height,center,bandwidth] = [1,0,1] | |
function kernel(x){ | |
return height*Math.exp( - ( ((x-center)**2)/(2*bandwidth**2) ) ) | |
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// identify 3-way intersections of identically named ways | |
// thus to identify/located divided/split roadways | |
// get nodes of all named ways | |
way[highway][name]({{bbox}})->.namedways; | |
// foreach way | |
foreach .namedways -> .thisway( | |
node(w.thisway)->.childnodes; | |
foreach.childnodes -> .thisnode( | |
// select named parent ways of this node with the same name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
way[highway][highway!~"footway|service|path|cycleway|steps|pedestrian"]({{bbox}}); | |
node(w); | |
way(bn)[highway=footway][footway=sidewalk]; | |
out body; | |
>; | |
out skel qt; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[timeout:600]; | |
// Hamilton County area by id | |
rel(104784); map_to_area->.ham; | |
// get older buildings inside the county | |
way(area.ham)[building](if: timestamp() < "2014-08-25")->.buildings; | |
// iterate over buildings, checking the dates on their nodes | |
foreach .buildings->.way { | |
// only add ways to the result set if nodes are also |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from_path = '/home/nate/Dropbox/muni-17477/' | |
to_path = '/home/nate/Dropbox/muni-17477-fixed/' | |
old_files = os.listdir(from_path) | |
for old_file in old_files: | |
old_fpath = from_path+old_file | |
with open(old_fpath,'r') as fp: | |
old_content = fp.read() | |
old_hour = old_file[11:13] | |
new_hour =str(int(old_hour)-3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=(cell-25569)*86400 - hour_offset*3600 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def inner_angle_plane(point1,point2,point3): | |
"""Given three points, p1 | |
calculate the smaller of the two angles \ a | |
formed by the sequence. \ | |
Returns degrees. p2------p3 | |
Input is three (x,y) tuples | |
""" | |
# be sure there IS an angle to measure | |
assert point1 != point2 and point2 != point3 | |
# get coordinate values |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests, json, psycopg2, multiprocessing, time, os | |
from random import shuffle | |
from datetime import datetime, timedelta | |
fileroot = 'itins/jv/sched-all-stops/' | |
# define the start time | |
start_time = datetime( year=2017, month=11, day=10 ) | |
print 'from ', start_time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this script takes a set of points, in this case bus stops | |
# and does a centroidal voronoi tesselation weighted by | |
# those points from an initial uniform random seeding. The effect | |
# is an even-ish distribution of sample points accross the space. | |
# My goal is to use these as representative ODs for a travel time | |
# matrix that effectively samples a whole transit network. | |
library('deldir') # voronoi stuff | |
library('rgdal') # projections | |
library('sp') # spatial data types |
NewerOlder