# Definition file for United States - Block Groups, 2012, from the # United States Census Bureau's TIGER shapefiles. # # Download using "./fetch.sh" to grab the state files. Then run: # # python manage.py loadshapefiles --only 2012-blockgroups # import sys sys.path.append("data/shapefiles") import census_helpers def get_feature_name(feature): #print { k: feature.get(k) for k in feature.feature.fields } return feature.get("GEOID") def get_feature_id(feature): return feature.get("GEOID") census_helpers.register_boundary( "blockgroups", "Block Groups", "bg", get_feature_name, get_feature_id)
# ftp://ftp2.census.gov/geo/tiger/TIGER2012/ZCTA5/tl_2012_us_zcta510.zip # # into this directory. Then run: # # python manage.py loadshapefiles --only 2012-zcta # import sys sys.path.append("data/shapefiles") import census_helpers def get_feature_name(mode): def g(feature): print feature.feature.fields global census_helpers state = census_helpers.state_fips_codes[int(feature.get("STATEFP"))] if mode == "name": return state + " " + feature.get("NAME") else: return state.lower() + "-" + feature.get("COUNTYFP") return g census_helpers.register_boundary("zctas", "ZCTAs", "zcta5", get_feature_name("name"), get_feature_name("id"))
# Definition file for United States - Block Groups, 2012, from the # United States Census Bureau's TIGER shapefiles. # # Download using "./fetch.sh" to grab the state files. Then run: # # python manage.py loadshapefiles --only 2012-blockgroups # import sys sys.path.append("data/shapefiles") import census_helpers def get_feature_name(feature): #print { k: feature.get(k) for k in feature.feature.fields } return feature.get("GEOID") def get_feature_id(feature): return feature.get("GEOID") census_helpers.register_boundary("blockgroups", "Block Groups", "bg", get_feature_name, get_feature_id)
# United States Census Bureau's TIGER shapefiles. # # Download # # ftp://ftp2.census.gov/geo/tiger/TIGER2012/COUNTY/tl_2012_us_county.zip # # into this directory. Then run: # # python manage.py loadshapefiles --only 2012-counties # python manage.py create-layer -c 2012-counties import sys sys.path.append("data/shapefiles") import census_helpers def get_feature_name(mode): def g(feature): global census_helpers state = census_helpers.state_fips_codes[int(feature.get("STATEFP"))] if mode == "name": return state + " " + feature.get("NAME") else: return state.lower() + "-" + feature.get("COUNTYFP") return g census_helpers.register_boundary("counties", "Counties", "county", get_feature_name("name"), get_feature_name("id"))
# # ftp://ftp2.census.gov/geo/tiger/TIGER2012/ZCTA5/tl_2012_us_zcta510.zip # # into this directory. Then run: # # python manage.py loadshapefiles --only 2012-zcta # import sys sys.path.append("data/shapefiles") import census_helpers def get_feature_name(mode): def g(feature): print feature.feature.fields global census_helpers state = census_helpers.state_fips_codes[int(feature.get("STATEFP"))] if mode == "name": return state + " " + feature.get("NAME") else: return state.lower() + "-" + feature.get("COUNTYFP") return g census_helpers.register_boundary("zctas", "ZCTAs", "zcta5", get_feature_name("name"), get_feature_name("id"))
# Definition file for United States - Census Plates, 2012, from the # United States Census Bureau's TIGER shapefiles. # # Download using "./fetch.sh" to grab the state files. Then run: # # python manage.py loadshapefiles --only 2012-places # import sys sys.path.append("data/shapefiles") import census_helpers def get_feature_name(feature): #print { k: feature.get(k) for k in feature.feature.fields } return feature.get("NAME") def get_feature_id(feature): return feature.get("GEOID") census_helpers.register_boundary("places", "Census Places", "place", get_feature_name, get_feature_id)
# # Download # # http://www2.census.gov/geo/tiger/TIGER2012/STATE/tl_2012_us_state.zip # # into this directory. Then run: # # python manage.py loadshapefiles --only 2012-states # import sys sys.path.append("data/shapefiles") import census_helpers def get_feature_name(mode): def g(feature): global state_fips_codes state = state_fips_codes[int(feature.get("STATEFP"))] if mode == "name": return state else: return state.lower() return g census_helpers.register_boundary("states", "States", "state", get_feature_name("name"), get_feature_name("id"))
# ftp://ftp2.census.gov/geo/tiger/TIGER2012/COUSUB/tl_2012_us_cousub.zip # # into this directory. Then run: # # python manage.py loadshapefiles --only 2012-countysubs # import sys sys.path.append("data/shapefiles") import census_helpers def get_feature_name(mode): def g(feature): print feature.feature.fields global census_helpers state = census_helpers.state_fips_codes[int(feature.get("STATEFP"))] if mode == "name": return state + " " + feature.get("NAME") else: return state.lower() + "-" + feature.get("COUNTYFP") return g census_helpers.register_boundary("countysubs", "County Subdivisions", "cousub", get_feature_name("name"), get_feature_name("id"))
# Download # # ftp://ftp2.census.gov/geo/tiger/TIGER2012/COUSUB/tl_2012_us_cousub.zip # # into this directory. Then run: # # python manage.py loadshapefiles --only 2012-countysubs # import sys sys.path.append("data/shapefiles") import census_helpers def get_feature_name(mode): def g(feature): print feature.feature.fields global census_helpers state = census_helpers.state_fips_codes[int(feature.get("STATEFP"))] if mode == "name": return state + " " + feature.get("NAME") else: return state.lower() + "-" + feature.get("COUNTYFP") return g census_helpers.register_boundary("countysubs", "County Subdivisions", "cousub", get_feature_name("name"), get_feature_name("id"))