Exemplo n.º 1
0
def download_tract_shapefile(state_fips: str, resolution: str) -> None:
    target_folder = src_path('cartographic_shapes')
    ct_url = ('http://www2.census.gov/geo/' +
              f'tiger/GENZ2010/gz_2010_{state_fips}_140_00_{resolution}.zip')
    zip_file_name = os.path.split(ct_url)[1]
    zip_file_path = os.path.join(target_folder, zip_file_name)
    if os.path.isfile(zip_file_path):
        print(f'{zip_file_name} already on disk')
        return
    else:
        urllib.request.urlretrieve(ct_url, zip_file_path)
Exemplo n.º 2
0
def carto_shapes_src_path(filename: str) -> str:
    return src_path('cartographic_boundaries', filename)
Exemplo n.º 3
0
def files_target_path(year: int, f_name: str) -> str:
    return src_path('tigerline', 'BLOCK', f'{year}', f_name)
Exemplo n.º 4
0
def _blocks_zip_path(state_fips: str) -> str:
    zip_path = src_path('census', 'shapefile_block',
                        f'tl_2010_{state_fips}_tabblock10.zip')
    return zip_path
Exemplo n.º 5
0
def _blocks_shape_path(state_fips: str) -> str:
    shp_path = src_path('census', 'shapefile_block',
                        f'tl_2010_{state_fips}_tabblock10.shp')
    return shp_path
Exemplo n.º 6
0
def _tracts_zip_path(state_fips: str) -> str:
    zip_path = src_path('census', 'census_tract_shapefiles_2010', 'zipped',
                        f'gz_2010_{state_fips}_140_00_500k.zip')
    return zip_path
Exemplo n.º 7
0
def year_path_root(year: int) -> str:
    return src_path('tigerline', 'ROADS', f'{year}')
Exemplo n.º 8
0
def zip_path(year: int) -> str:
    zipname = f'tl_{year}_us_county.zip'
    zippath = src_path('tigerline', 'COUNTY', f'{year}', zipname)
    return zippath
Exemplo n.º 9
0
def _download(year: int) -> None:
    ftp = ftp_connection(year)
    ftp.cwd('COUNTY')
    fname = ftp.nlst()[0]
    get_binary(fname, src_path('tigerline', 'COUNTY', f'{year}', fname), ftp)
    ftp.close()