Skip to content

Instantly share code, notes, and snippets.

View jwass's full-sized avatar

Jacob Wasserman jwass

View GitHub Profile
@jwass
jwass / README.md
Last active August 29, 2015 14:20
Logging imported Python modules

Quick idea to understand what modules get imported.

Example:

>>> import importlog

# Run a bunch of code
>>> import shapely.geometry
>>> p = shapely.geometry.Point(0.0, 0.0)
>>> b = p.buffer(1.0)
@jwass
jwass / example.json
Created March 20, 2015 16:17
Quick thoughts on representing a road network in JSON. Basically TopoJSON for OSM nodes/ways.
{
"type": "network",
"nodes": [
{"coordinates": [-71.13568, 42.38196], "properties": {}},
{"coordinates": [-71.13555, 42.382523], "properties": {"highway": "traffic_signals"}},
{"coordinates": [-71.134087, 42.38384], "properties": {"railway": "level_crossing"}},
{"coordinates": [-71.141007, 42.386862], "properties": {"highway": "crossing"}}
],
"geometries": [
{"type": "LineString", "nodes": [0, 1, 2], "properties": {"highway": "primary", "name": "Main Street"}},
@jwass
jwass / README.md
Last active December 29, 2015 04:02
GeoPandas Tornado Analysis

Thinking about the Turf tornado analysis from https://www.mapbox.com/blog/60-years-of-tornadoes-with-turf/ and what the similar approacoh is in GeoPandas.

The two programs take slightly different approaches to the counting. Turf loops over the counties, counting how many tornadoes fall inside its borders. GeoPandas performs a spatial join - first forming a spatial index on the tornadoes. The joined GeoDataFrame combines the columns (properties) of both sets. Then a groupby operation is performed counting the number of entries for each county.

The Turf version is significantly faster - most likely due to the slow spatial join operation in GeoPandas and that all columns are included resulting in a large final DataFrame - and probably just that node is much faster than Python here. Overall, Turf's speed is impressive.

@jwass
jwass / geojsonio_embed.ipynb
Created August 18, 2014 18:02
Embed geojson.io in a Jupyter / IPython notebook using geojsonio.py
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jwass
jwass / RK_gpx _2014-07-10_2054.gpx
Created August 16, 2014 02:11
GPX file recorded by Runkeeper
<?xml version="1.0" encoding="UTF-8"?>
<gpx
version="1.1"
creator="RunKeeper - http://www.runkeeper.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/1"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1">
<trk>
<name><![CDATA[Running 7/10/14 8:54 pm]]></name>
@jwass
jwass / boros.geojson
Created July 10, 2014 04:39
Test boros
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jwass
jwass / README.md
Created June 27, 2014 04:38
beeradvocate.com's top 250 beer list. Data modified from http://epic-curiousity.com/2014/06/beer-bucket-list-map-top-250.html
@jwass
jwass / roundabouts.geojson
Created June 23, 2014 18:31
OSM Rotaries within the I-495 Loop
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jwass
jwass / meter_counts.geojson
Created June 5, 2014 13:33
Top 100 ticketed meters in Cambridge, MA
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.