Skip to content

Instantly share code, notes, and snippets.

View jlaura's full-sized avatar
🏠
Working from home

Jay Laura jlaura

🏠
Working from home
  • USGS Astrogeology
  • Flagstaff AZ
  • 04:58 (UTC -07:00)
View GitHub Profile
@jlaura
jlaura / index.html
Last active August 29, 2015 14:06
PySAL Tree
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.node {
cursor: pointer;
}
.node circle {
fill: #fff;
@jlaura
jlaura / testcKDTree.py
Created July 8, 2014 19:49
Test the cKDTree in scipy.spatial for replacement in the PySAL library
import os
from subprocess import call
import sys
import pysal
from numpy.testing import assert_equal
shps_to_test = []
examplesdir = 'examples/'
@jlaura
jlaura / osrmparser.py
Last active August 29, 2015 14:00
Parse the OSRM data file into NumPy objects.
from struct import unpack
import numpy as np
import sys
#OSRM data type - nodes
node_dtype = np.dtype([('lat', '<i'), ('long', '<i'), ('id', '<I'), ('Flags', '<i')])
#Reading the .osrm file
f = open(sys.argv[1])
f.seek(156) # Skip the header
import math
%pylab inline
def createhex(xoff=1,yoff=1):
A = (math.cos(math.radians(30)), math.sin(math.radians(30)))
B = (math.cos(math.radians(90)), sin(math.radians(90)))
C = (math.cos(math.radians(150)), sin(math.radians(150)))
D = (math.cos(math.radians(210)), sin(math.radians(210)))
E = (math.cos(math.radians(270)), sin(math.radians(270)))
F = (math.cos(math.radians(330)), sin(math.radians(330)))
@jlaura
jlaura / gist:6223127
Created August 13, 2013 16:49
VBA map generation using arcpy
import arcpy
import pythonaddins
class LayerList(object):
"""Implementation for valuebyalpha_addin.combobox (ComboBox)"""
def __init__(self):
self.editable = True
self.enabled = True
self.dropdownWidth = 'WWWWWW'
self.width = 'WWWWWW'