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
results=$(ls -p *2016.zip | grep -v /) | |
for r in $results; do | |
ogr2ogr -f "geojson" ntl16.geojson "/vsizip/"$r -update -append -nln state \ | |
-t_srs EPSG:4326 \ | |
-dialect "SQLite" -sql \ | |
"SELECT '${r:0:2}' AS state, G16PRERTru as pres_16_R, G16PREDCli as pres_16_D, | |
Geometry FROM ${r%.*}" | |
done; |
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 pandas as pd | |
import geopandas as gp | |
import re | |
from itertools import chain | |
medsl = pd.read_csv('/Users/jacobcoblentz/Downloads/2016-precinct-president.csv', encoding = 'LATIN1') | |
medsl = medsl[medsl.state_postal == 'NY'] |
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
# 001 Albany, To Start | |
ogr2ogr -sql "SELECT '36' AS state, '001' AS county, CAST(DistName AS character(20)) AS precinct, 'polygon' AS accuracy FROM \"001-Albany\"" \ | |
-s_srs EPSG:2260 -t_srs EPSG:4326 -nln state -f geojson \ | |
'NY_State_Full.geojson' \ | |
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/001-albany/2012/001-Albany.shp' | |
# Add 003-allegany | |
ogr2ogr -sql "SELECT '36' AS state, '003' AS county, CAST(NAMELSAD10 AS character(20)) AS precinct, 'polygon' AS accuracy FROM ElectionDistricts2014" \ |
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 tweepy | |
from datetime import datetime, timedelta | |
# options | |
test_mode = False | |
verbose = True | |
delete_tweets = True | |
delete_favs = True | |
days_to_keep = 0 # for whe all of your tweets are really that bad |