Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
| -1 0 0 0 | |
| 0 0 0 255 | |
| 24999 150 200 255 | |
| 25000 0 180 0 # 05, dark green | |
| 38000 140 255 0 # 25, green | |
| 51000 255 255 80 # 50, yello | |
| 70000 255 210 130 # 75, brown | |
| 110000 210 210 210 # 95, grey | |
| 150000 255 255 255 # high, white |
This file contains hidden or 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
| cat usa_00028.csv | cut -d, -f7,54,61,93 | awk -F "," '$3 == 3060' | awk -F "," -v OFS=, '{print $1,$2,$3,($4 > 100)}' > to_file.csv |
This file contains hidden or 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
| #!/usr/bin/env python | |
| import matplotlib.pyplot as plt | |
| import geopandas as gpd | |
| import pandas as pd | |
| import geopandas as gpd | |
| import numpy as np | |
| from fiona.crs import from_epsg |
This file contains hidden or 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
| def fix_ak_hi(X): | |
| ak_mask = X.centroid.apply(lambda x: x.coords[0][1] > 1e6) | |
| X.loc[ak_mask, X.geometry.name] = X.loc[ak_mask].geometry\ | |
| .rotate(0.63, (-3000000, 2500000), use_radians = True)\ | |
| .scale(0.38, 0.38, 0.38, (0, 0, 0))\ | |
| .translate(-1.5e5, -3.15e6) | |
| hi_mask = X.centroid.apply(lambda x: x.coords[0][0] < -4e6) | |
| X.loc[hi_mask, X.geometry.name] = X.loc[hi_mask].geometry\ |
This file contains hidden or 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
| -- SIMPLIFIED CENSUS GEOMETRY IN POSTGIS | |
| -- COPIED FROM https://strk.kbt.io/blog/2012/04/13/simplifying-a-map-layer-using-postgis-topology/ | |
| CREATE OR REPLACE FUNCTION SimplifyEdgeGeom(atopo varchar, anedge int, maxtolerance float8) | |
| RETURNS float8 AS $$ | |
| DECLARE | |
| tol float8; | |
| sql varchar; | |
| BEGIN | |
| tol := maxtolerance; |
This file contains hidden or 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
| #!/usr/bin/env python | |
| import matplotlib.pyplot as plt | |
| import geopandas as gpd | |
| import pandas as pd | |
| import geopandas as gpd | |
| import numpy as np | |
| from fiona.crs import from_epsg |
This file contains hidden or 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
| SELECT d.state, d.puma, | |
| pm.pop pop, ST_Area(pm.geom) A, | |
| d.hs, d.ba, ba_pop, | |
| d.cum_pop, d.cum_area, | |
| d.cum_hs, d.cum_ba, | |
| d.distance, pl.geometry | |
| FROM PlotPuma() pl | |
| JOIN puma pm ON -- plotting version, distorted AK | |
| pl.state = pm.state AND pl.puma = pm.puma | |
| JOIN ( -- for calculations. |
This file contains hidden or 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
| #!/usr/bin/env python | |
| import matplotlib.pyplot as plt | |
| import geopandas as gpd | |
| import pandas as pd | |
| import geopandas as gpd | |
| import numpy as np | |
| from fiona.crs import from_epsg |
This file contains hidden or 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
| #!/bin/bash | |
| # mkdir -p tmp/dec/ | |
| cd tmp/dec/ | |
| # wget -r ftp://ftp2.census.gov/geo/tiger/PREVGENZ/tr/tr90shp/ | |
| # wget -r ftp://ftp2.census.gov/geo/tiger/PREVGENZ/tr/tr00shp/ | |
| # wget -r ftp://ftp2.census.gov/geo/tiger/GENZ2010/gz_2010_*_140_00_500k.zip | |
| # mv ftp2.census.gov/geo/tiger/PREVGENZ/tr/tr90shp/*zip dec/ | |
| # mv ftp2.census.gov/geo/tiger/PREVGENZ/tr/tr00shp/*zip dec/ | |
| # mv ftp2.census.gov/geo/tiger/GENZ2010/*zip dec/ |