Skip to content

Instantly share code, notes, and snippets.

View d-wasserman's full-sized avatar

David Wasserman d-wasserman

View GitHub Profile
@calvinmetcalf
calvinmetcalf / README.md
Created July 20, 2012 11:50
Using ESRI JSON in Leaflet

Basic example of taking an output from our server and putting it on a map. As leaflet allows you to add geoJSON directly, we convert it from esri's JSON format to a more standard one.

@erussell
erussell / .gitignore
Created July 25, 2012 14:59
Python script to be run daily to maintain an ArcGIS mosaic dataset of Growing Degree Days, using tempertaure data from the Historical Climate Network
/data
/mosaic.gdb
/scratch.gdb
@odoe
odoe / geotofeature.py
Created September 10, 2012 21:13
ArcPy script to Convert GeoJSON to Feature Classes
# This is a script that I use to convert geojson to
# features in a file gdb
# Step 1. Use the REST page of an ArcGIS Map Service to
# get the esri json results of the data you want.
# Step 2. I used my EsriJSON to GeoJSON app to convert
# the results to geojson. http://esritogeo.herokuapp.com/
# Step 3. In ArcMap, use the python window to create a
# python dictionary of your geojson.
# Step4. Use the following script to convert that geojson
# into featureclasses and then merge them.
@seberg
seberg / rolling_window.py
Created October 10, 2012 14:38
Multidimensional rolling_window for numpy
def rolling_window(array, window=(0,), asteps=None, wsteps=None, axes=None, toend=True):
"""Create a view of `array` which for every point gives the n-dimensional
neighbourhood of size window. New dimensions are added at the end of
`array` or after the corresponding original dimension.
Parameters
----------
array : array_like
Array to which the rolling window is applied.
window : int or tuple
@iamatypeofwalrus
iamatypeofwalrus / roll_ipython_in_aws.md
Last active January 22, 2024 11:18
Create an iPython HTML Notebook on Amazon's AWS Free Tier from scratch.

What

Roll your own iPython Notebook server with Amazon Web Services (EC2) using their Free Tier.

What are we using? What do you need?

  • An active AWS account. First time sign-ups are eligible for the free tier for a year
  • One Micro Tier EC2 Instance
  • With AWS we will use the stock Ubuntu Server AMI and customize it.
  • Anaconda for Python.
  • Coffee/Beer/Time
@frankrowe
frankrowe / shp2gj.py
Last active November 1, 2022 17:54
PyShp, shp to geojson in python
import shapefile
# read the shapefile
reader = shapefile.Reader("my.shp")
fields = reader.fields[1:]
field_names = [field[0] for field in fields]
buffer = []
for sr in reader.shapeRecords():
atr = dict(zip(field_names, sr.record))
geom = sr.shape.__geo_interface__
buffer.append(dict(type="Feature", \
@nsonnadsnip
nsonnadsnip / allButThis.js
Last active December 11, 2018 01:29 — forked from nsonnad/D3: Select all but this
d3: select all but this
function mouseOn () {
var circleUnderMouse = this;
d3.selectAll('.rectGroup').transition().style('opacity',function () {
return (this === circleUnderMouse) ? 1.0 : 0.5;
});
}
@RobertSudwarts
RobertSudwarts / deg_to_cardinal.py
Created June 7, 2015 16:18
[python] degrees to cardinal directions
def degrees_to_cardinal(d):
'''
note: this is highly approximate...
'''
dirs = ["N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE",
"S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"]
ix = int((d + 11.25)/22.5)
return dirs[ix % 16]
@Keareys
Keareys / gist:75a4e7a4e1b7260b3099563378424684
Last active November 8, 2020 17:08
Census API Example Calls for Key Demographic Attributes used in Environmental Justice Work at MTC
Primary Census API Documentation Page:
http://www.census.gov/data/developers/data-sets.html
ACS Summary File Documentation
Other Useful Documentation Examples:
http://www.opengeocode.org/tutorials/USCensusAPI.php
https://www.socialexplorer.com/data/ACS2010/documentation/781dcba1-deed-47f9-a223-0cbc4e2b65b6
#!/usr/bin/python3.5
# -*-coding:Utf-8 -*
import random
import operator
import time
import matplotlib.pyplot as plt
temps1 = time.time()