Skip to content

Instantly share code, notes, and snippets.

@jpcoblentz
Created July 2, 2020 16:35
Show Gist options
  • Save jpcoblentz/e4d0ee4389daf063450b404c3b7585ca to your computer and use it in GitHub Desktop.
Save jpcoblentz/e4d0ee4389daf063450b404c3b7585ca to your computer and use it in GitHub Desktop.
# 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" \
-s_srs '+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/003-Allegany/ElectionDistricts2014.shp'
# Add 007-broome
ogr2ogr -sql "SELECT '36' AS state, '007' AS county, CAST(FULLNAME AS character(20)) AS precinct, 'polygon' AS accuracy FROM broome_ed" \
-s_srs '+proj=tmerc +lat_0=40 +lon_0=-76.58333333333333 +k=0.9999375 +x_0=250000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=us-ft +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/007-broome/broome_ed.shp'
# Add 009-cattaraugus
ogr2ogr -sql "SELECT '36' AS state, '009' AS county, CAST(DISTRICT AS character(20)) AS precinct, 'polygon' AS accuracy FROM CattaraugusVotingDistricts" \
-s_srs '+proj=tmerc +lat_0=40 +lon_0=-78.58333333333333 +k=0.9999375 +x_0=350000.0000000001 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=us-ft +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/009-Cattaraugus/CattaraugusVotingDistricts.shp'
# Add 011-cayuga
ogr2ogr -sql "SELECT '36' AS state, '011' AS county, CONCAT(CAST(MUNI AS character(20)),' ' ,CAST(District AS character(20))) AS precinct, 'polygon' AS accuracy FROM Cayuga_County_NY_Elect_Dists" \
-skipfailures -s_srs '+proj=tmerc +lat_0=40 +lon_0=-76.58333333333333 +k=0.9999375 +x_0=152400.3048006096 +y_0=0 +datum=NAD27 +units=us-ft +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/011-cayuga/Cayuga_County_NY_Elect_Dists.shp'
# 015-chemung aren't polygons :(
# 019-clinton
ogr2ogr -dialect SQLITE -sql "SELECT '36' AS state, '019' AS county, \
CAST(Name AS character(20)) AS precinct, 'polygon' AS accuracy FROM ClintonEDs" \
-s_srs EPSG:2260 -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/019-clinton/ClintonEDs.shp'
# 023-cortland
ogr2ogr -sql "SELECT '36' AS state, '023' AS county, CAST(ED AS character(20)) AS precinct, 'polygon' AS accuracy FROM election_districts" \
-s_srs '+proj=tmerc +lat_0=40 +lon_0=-76.58333333333333 +k=0.9999375 +x_0=250000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=us-ft +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/023-cortland/election_districts.shp'
# 027-dutchess. not 100% sure that DISTRICT is the right column
ogr2ogr -sql "SELECT '36' AS state, '027' AS county, CAST(District AS character(20)) AS precinct, 'polygon' AS accuracy FROM \"2012_EDs-Dutchess\"" \
-s_srs '+proj=longlat +ellps=GRS80 +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/027-dutchess/2012_EDs-Dutchess.shp'
# 029-erie
ogr2ogr -sql "SELECT '36' AS state, '029' AS county, CAST(TWD AS character(20)) AS precinct, 'polygon' AS accuracy FROM \"2015 ED Final\"" \
-s_srs EPSG:2260 -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/029-erie/2015 ED Final.shp'
# 031-essex
ogr2ogr -sql "SELECT '36' AS state, '031' AS county, CONCAT(CAST(TOWN AS character(20)), ' ' ,CAST(DIST_NUM AS character(20))) AS precinct, 'polygon' AS accuracy FROM ED15" \
-s_srs '+proj=tmerc +lat_0=40 +lon_0=-74.33333333333333 +k=0.9999666666666667 +x_0=152400.3048006096 +y_0=0 +datum=NAD27 +units=us-ft +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/031-essex/ED15.shp'
# 043-herkimer
ogr2ogr -sql "SELECT '36' AS state, '043' AS county, CAST(Name AS character(20)) AS precinct, 'polygon' AS accuracy FROM \"2012_EDs-Herkimer\"" \
-s_srs '+proj=longlat +ellps=GRS80 +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/043-herkimer/2012_EDs-Herkimer.shp'
# 055-monroe
ogr2ogr -dialect SQLITE -sql "SELECT '36' AS state, '055' AS county, \
CASE WHEN UPPER(TOWN) LIKE '%ROCHESTER%' THEN 'Leg. Dist.' || ' ' || \
CAST(CAST(legdist AS INT) AS CHAR(10)) || ' ' || CAST(CAST(district AS INT) AS CHAR(10)) \
ELSE TOWN || ' ' || CAST(CAST(district AS INT) AS CHAR(10)) END
AS precinct, 'polygon' AS accuracy FROM \"2012_EDs-Monroe\"" \
-s_srs '+proj=tmerc +lat_0=40 +lon_0=-78.58333333333333 +k=0.9999375 +x_0=350000.0000000001 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=us-ft +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/055-monroe/2012_EDs-Monroe.shp'
# 059-nassau -lol nothing matches
ogr2ogr -sql "SELECT '36' AS state, '059' AS county, CAST(ID AS character(20)) AS precinct, 'polygon' AS accuracy FROM \"Nassau County Election Districts\"" \
-s_srs '+proj=longlat +ellps=GRS80 +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/059-nassau/Nassau County Election Districts.shp'
#061 - NYC
ogr2ogr -sql "SELECT '36' AS state, county, CAST(ElectDist AS character(5)) AS precinct, 'polygon' AS accuracy FROM nyed" \
-s_srs '+proj=lcc +lat_1=40.66666666666666 +lat_2=41.03333333333333 +lat_0=40.16666666666666 +lon_0=-74 +x_0=300000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=us-ft +no_defs' \
-t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/005-047-061-081-085-New_York_City/2016/nyed_16d_clean/nyed.shp'
# 063-niagara
ogr2ogr -sql "SELECT '36' AS state, '063' AS county, CONCAT(CAST(City_Town AS character(20)), ' ' ,CAST(District AS character(20))) AS precinct, 'polygon' AS accuracy FROM \"2012_EDs-Niagara\"" \
-s_srs '+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/063-niagara/2012_EDs-Niagara.shp'
# 065-oneida
ogr2ogr -sql "SELECT '36' AS state, '065' AS county, \
CAST(BOE_NAME AS character(20)) \
AS precinct, \
'polygon' AS accuracy FROM \"2012_EDs-Oneida\"" \
-s_srs '+proj=longlat +ellps=GRS80 +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/065-oneida/2012_EDs-Oneida.shp'
# 067-onondaga
ogr2ogr -dialect SQLITE -sql "SELECT '36' AS state, '067' AS county, \
CASE WHEN UPPER(TOWN) LIKE '%SYRACUSE%' THEN 'W' || CITY_WARD ||'P' || elect_dist \
ELSE CAST(TOWN AS character(20)) || ' ' || IFNULL(TOWN_WARD, '') || IFNULL(elect_dist, '') END \
AS precinct, 'polygon' AS accuracy FROM election_districts" \
-s_srs '+proj=tmerc +lat_0=40 +lon_0=-76.58333333333333 +k=0.9999375 +x_0=250000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=us-ft +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/067-onondaga/election_districts.shp'
# Add 069-ontario
ogr2ogr -sql "SELECT '36' AS state, '069' AS county, CAST(NAME AS character(20)) AS precinct, 'polygon' AS accuracy FROM BOE_Election_Districts" \
-s_srs '+proj=tmerc +lat_0=40 +lon_0=-76.58333333333333 +k=0.9999375 +x_0=250000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=us-ft +no_defs' \
-t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/069-ontario/BOE_Election_Districts.shp'
# 071-orange
ogr2ogr -sql "SELECT '36' AS state, '071' AS county, CAST(POLLID AS character(20)) AS precinct, 'polygon' AS accuracy FROM \"OC_ElectionDistricts2014\"" \
-s_srs EPSG:2260 -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/071-orange/OC_ElectionDistricts2014.shp'
# 073-orleans
ogr2ogr -sql "SELECT '36' AS state, '073' AS county, CAST(ID_ AS character(10)) AS precinct, 'polygon' AS accuracy FROM ALBIVOTE" \
-s_srs '+proj=longlat +ellps=clrk66 +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/073-orleans/ALBIVOTE.SHP'
ogr2ogr -sql "SELECT '36' AS state, '073' AS county, CAST(ID_ AS character(10)) AS precinct, 'polygon' AS accuracy FROM CLARVOTE" \
-s_srs '+proj=longlat +ellps=clrk66 +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/073-orleans/CLARVOTE.SHP'
ogr2ogr -sql "SELECT '36' AS state, '073' AS county, CAST(ID_ AS character(10)) AS precinct, 'polygon' AS accuracy FROM MURRVOTE" \
-s_srs '+proj=longlat +ellps=clrk66 +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/073-orleans/MURRVOTE.SHP'
ogr2ogr -sql "SELECT '36' AS state, '073' AS county, CAST(ID_ AS character(10)) AS precinct, 'polygon' AS accuracy FROM BARRVOTE" \
-s_srs '+proj=longlat +ellps=clrk66 +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/073-orleans/BARRVOTE.SHP'
ogr2ogr -sql "SELECT '36' AS state, '073' AS county, CAST(ID_ AS character(10)) AS precinct, 'polygon' AS accuracy FROM GAINVOTE" \
-s_srs '+proj=longlat +ellps=clrk66 +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/073-orleans/GAINVOTE.SHP'
ogr2ogr -sql "SELECT '36' AS state, '073' AS county, CAST(ID_ AS character(10)) AS precinct, 'polygon' AS accuracy FROM SHELVOTE" \
-s_srs '+proj=longlat +ellps=clrk66 +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/073-orleans/SHELVOTE.SHP'
ogr2ogr -sql "SELECT '36' AS state, '073' AS county, CAST(ID_ AS character(10)) AS precinct, 'polygon' AS accuracy FROM CARLVOTE" \
-s_srs '+proj=longlat +ellps=clrk66 +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/073-orleans/CARLVOTE.SHP'
ogr2ogr -sql "SELECT '36' AS state, '073' AS county, CAST(ID_ AS character(10)) AS precinct, 'polygon' AS accuracy FROM KENDVOTE" \
-s_srs '+proj=longlat +ellps=clrk66 +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/073-orleans/KENDVOTE.SHP'
ogr2ogr -sql "SELECT '36' AS state, '073' AS county, CAST(ID_ AS character(10)) AS precinct, 'polygon' AS accuracy FROM YATEVOTE" \
-s_srs '+proj=longlat +ellps=clrk66 +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/073-orleans/YATEVOTE.SHP'
ogr2ogr -sql "SELECT '36' AS state, '073' AS county, CAST(ID_ AS character(10)) AS precinct, 'polygon' AS accuracy FROM Ridgevote" \
-s_srs '+proj=longlat +ellps=clrk66 +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/073-orleans/Ridgevote.shp'
# 075-oswego
ogr2ogr -sql "SELECT '36' AS state, '075' AS county, CAST(LONGNAME AS character(10)) AS precinct, 'polygon' AS accuracy FROM funal_run_4" \
-s_srs '+proj=longlat +datum=WGS84 +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/075-oswego/funal_run_4.shp'
# 077-ostego
ogr2ogr -sql "SELECT '36' AS state, '077' AS county, CAST(CO_NAME AS character(10)) AS precinct, 'polygon' AS accuracy FROM \"Otsego_Voting_2012_Final\"" \
-s_srs EPSG:2260 -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/077-otsego/Otsego_Voting_2012_Final.shp'
# 079-putnam. ELECT_CTY_ vs ELECT_CTY_1_ ?
ogr2ogr -sql "SELECT '36' AS state, '079' AS county, CAST(ELECT_CTY_ AS character(10)) AS precinct, 'polygon' AS accuracy FROM \"2012_EDs-Putnam\"" \
-s_srs EPSG:2260 -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/079-putnam/2012_EDs-Putnam.shp'
# Add 083-rensselaer
ogr2ogr -sql "SELECT '36' AS state, '083' AS county, CAST(LABEL AS character(20)) AS precinct, 'polygon' AS accuracy FROM cnty_ed" \
-s_srs EPSG:2260 -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/083-rensselaer/cnty_ed.shp'
# 087-rockland
ogr2ogr -sql "SELECT '36' AS state, '087' AS county, CONCAT(CAST(TOWN AS character(20)) ,' ', CAST(ED_NUM AS character(10))) AS precinct, 'polygon' AS accuracy FROM \"Cty_ED_Jan_15_2016\"" \
-s_srs EPSG:2260 -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/087-rockland/Cty_ED_Jan_15_2016.shp'
# 089-st-lawrence
ogr2ogr -sql "SELECT '36' AS state, '089' AS county, CONCAT(CAST(TOWN AS character(20)) ,' ', CAST(ED AS character(10))) AS precinct, 'polygon' AS accuracy FROM \"2012_EDs-St_Lawrence\"" \
-s_srs '+proj=utm +zone=18 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/089-St_Lawrence/2012_EDs-St_Lawrence.shp'
# 093-schenectady
ogr2ogr -sql "SELECT '36' AS state, '093' AS county, CAST(DISTRICT AS character(10)) AS precinct, 'polygon' AS accuracy FROM \"2012_EDs-Duanesburg\"" \
-s_srs EPSG:2260 -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/093-schenectady/2012_EDs-Duanesburg.shp'
ogr2ogr -sql "SELECT '36' AS state, '093' AS county, CAST(DISTRICT AS character(10)) AS precinct, 'polygon' AS accuracy FROM \"2012_EDs-Glenville\"" \
-s_srs EPSG:2260 -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/093-schenectady/2012_EDs-Glenville.shp'
ogr2ogr -sql "SELECT '36' AS state, '093' AS county, CAST(DISTRICT AS character(10)) AS precinct, 'polygon' AS accuracy FROM \"2012_EDs-Niskayuna\"" \
-s_srs EPSG:2260 -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/093-schenectady/2012_EDs-Niskayuna.shp'
ogr2ogr -sql "SELECT '36' AS state, '093' AS county, CAST(DISTRICT AS character(10)) AS precinct, 'polygon' AS accuracy FROM \"2012_EDs-Princetown\"" \
-s_srs EPSG:2260 -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/093-schenectady/2012_EDs-Princetown.shp'
ogr2ogr -sql "SELECT '36' AS state, '093' AS county, CAST(DISTRICT AS character(10)) AS precinct, 'polygon' AS accuracy FROM \"2012_EDs-Rotterdam\"" \
-s_srs EPSG:2260 -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/093-schenectady/2012_EDs-Rotterdam.shp'
ogr2ogr -sql "SELECT '36' AS state, '093' AS county, CONCAT('36093', CAST(DISTRICT_ AS character(10))) AS precinct, 'polygon' AS accuracy FROM \"2012_EDs-Schenectady_\"" \
-s_srs EPSG:2260 -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/093-schenectady/2012_EDs-Schenectady_.shp'
# 095-schoharie
ogr2ogr -sql "SELECT '36' AS state, '095' AS county, CAST(TOWNNAME AS character(20)) AS precinct, 'polygon' AS accuracy FROM \"ElectionDists\"" \
-s_srs '+proj=utm +zone=18 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/095-schoharie/ElectionDists.shp'
# 101-steuben
ogr2ogr -sql "SELECT '36' AS state, '101' AS county, CAST(FullDist AS character(20)) AS precinct, 'polygon' AS accuracy FROM \"ElectionDistricts\"" \
-s_srs '+proj=tmerc +lat_0=40 +lon_0=-76.58333333333333 +k=0.9999375 +x_0=250000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=us-ft +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/101-steuben/ElectionDistricts.shp'
# 103-suffolk
ogr2ogr -sql "SELECT '36' AS state, '103' AS county, CAST(ED AS character(10)) AS precinct, 'polygon' AS accuracy FROM \"2012 ED Files\"" \
-s_srs EPSG:2260 -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/103-suffolk/2012 ED Files.shp'
# 107-tioga
ogr2ogr -sql "SELECT '36' AS state, '107' AS county, CAST(VDISTRICT AS character(20)) AS precinct, 'polygon' AS accuracy FROM \"2012_EDs-Tioga\"" \
-s_srs '+proj=tmerc +lat_0=40 +lon_0=-76.58333333333333 +k=0.9999375 +x_0=250000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=us-ft +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/107-tioga/2012_EDs-Tioga.shp'
# 109-tompkins
ogr2ogr -sql "SELECT '2014' AS year, '36' AS state, '109' AS county, CAST(DISTNAME AS character(20)) AS precinct, 'polygon' AS accuracy FROM \"ElDistricts2014\"" \
-s_srs '+proj=tmerc +lat_0=40 +lon_0=-76.58333333333333 +k=0.9999375 +x_0=250000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=us-ft +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/109-tompkins/ElDistricts2014.shp'
# 111-ulster
ogr2ogr -sql "SELECT '36' AS state, '111' AS county, \
CONCAT(CAST(MUNI AS character(20)), ' ', CAST(DISTRICT AS character(2)), '-', CAST(WARD AS character(2))) AS precinct, \
'polygon' AS accuracy FROM \"2012_EDs-Ulster\"" \
-s_srs 'EPSG:2260' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/111-ulster/2012_EDs-Ulster.shp'
# 113-warren
ogr2ogr -sql "SELECT '36' AS state, '113' AS county, \
CONCAT(CAST(TOWN AS character(20)), ' ', CAST(WARD AS character(2))) AS precinct, \
'polygon' AS accuracy FROM \"2012_EDs-Warren\"" \
-s_srs EPSG:2260 -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/113-warren/2012_EDs-Warren.shp'
# 115-washington
ogr2ogr -sql "SELECT '36' AS state, '115' AS county,
CONCAT('36115', CAST(TOWN AS character(10)),' ' ,CAST(DISTRICT AS character(10))) AS precinct, 'polygon' AS accuracy FROM \"election_districts\"" \
-s_srs EPSG:2260 -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/115-washington/election_districts.shp'
# 119-westchester
ogr2ogr -sql "SELECT '36' AS state, '119' AS county, CAST(ED AS character(10)) AS precinct, 'polygon' AS accuracy FROM \"Westchester 2014 Election Districts\"" \
-s_srs '+proj=longlat +ellps=GRS80 +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/119-westchester/Westchester 2014 Election Districts.shp'
# 123-yates
ogr2ogr -sql "SELECT '36' AS state, '123' AS county, CONCAT('36123', CAST(District AS character(10))) AS precinct, 'polygon' AS accuracy FROM \"2012_EDs-Yates\"" \
-s_srs '+proj=tmerc +lat_0=40 +lon_0=-76.58333333333333 +k=0.9999375 +x_0=250000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=us-ft +no_defs' -t_srs EPSG:4326 -nln state -append -f geojson 'NY_State_Full.geojson' \
'/Users/jacobcoblentz/unfolded/voting/2016/projects/NY/NY_shapefiles/123-yates/2012_EDs-Yates.shp'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment