30 census data
Uncomment the following line to install leafmap if needed.
In [1]:
Copied!
# !pip install leafmap
# !pip install leafmap
In [2]:
Copied!
import leafmap
import leafmap
Get the Census data WMS tiles as a dictionary. More info can be found at https://tigerweb.geo.census.gov/tigerwebmain/TIGERweb_wms.html
In [3]:
Copied!
census_data_dict = leafmap.get_census_dict()
census_data_dict = leafmap.get_census_dict()
Print out the list of US Census WMS.
In [4]:
Copied!
for key in census_data_dict:
print(key)
for key in census_data_dict:
print(key)
Current ACS 2021 ACS 2019 ACS 2018 ACS 2017 ACS 2016 ACS 2015 ACS 2014 ACS 2013 ACS 2012 ECON 2012 Census 2020 Census 2010 Physical Features Decennial Census 2020 Decennial Census 2010 Decennial Census 2000 Decennial Physical Features
Get the list of layers for a WMS.
In [5]:
Copied!
census_data_dict["Census 2020"]["layers"]
census_data_dict["Census 2020"]["layers"]
Out[5]:
['Alaska_Native_Regional_Corporations10465', 'Alaska_Native_Regional_Corporations_Labels60868', 'Alaska_Native_Village_Statistical_Areas34178', 'Alaska_Native_Village_Statistical_Areas_Labels14319', 'American_Indian_Joint-Use_Areas11842', 'American_Indian_Joint-Use_Areas_Labels32943', 'Census_Block_Groups59805', 'Census_Block_Groups_Labels32376', 'Census_Blocks1978', 'Census_Blocks_Labels63431', 'Census_Designated_Places65166', 'Census_Designated_Places_Labels61459', 'Census_Divisions8578', 'Census_Divisions_Labels29679', 'Census_Regions16659', 'Census_Regions_Labels31526', 'Census_Tracts7651', 'Census_Tracts_Labels33558', 'Combined_New_England_City_and_Town_Areas35117', 'Combined_New_England_City_and_Town_Areas_Labels20328', 'Combined_Statistical_Areas61231', 'Combined_Statistical_Areas_Labels52090', 'Consolidated_Cities65047', 'Consolidated_Cities_Labels30018', 'Counties', 'Counties_Labels19364', 'County_Subdivisions63689', 'County_Subdivisions_Labels25452', 'Elementary_School_Districts36200', 'Elementary_School_Districts_Labels21637', 'Estates', 'Estates_Labels15809', 'Federal_American_Indian_Reservations63680', 'Federal_American_Indian_Reservations_Labels65437', 'Hawaiian_Home_Lands45702', 'Hawaiian_Home_Lands_Labels15115', 'Incorporated_Places1469', 'Incorporated_Places_Labels58904', 'Metropolitan_Divisions40847', 'Metropolitan_Divisions_Labels25946', 'Metropolitan_New_England_City_and_Town_Areas62616', 'Metropolitan_New_England_City_and_Town_Areas_Labels59733', 'Metropolitan_Statistical_Areas62762', 'Metropolitan_Statistical_Areas_Labels6295', 'Micropolitan_New_England_City_and_Town_Areas31587', 'Micropolitan_New_England_City_and_Town_Areas_Labels33942', 'Micropolitan_Statistical_Areas31521', 'Micropolitan_Statistical_Areas_Labels772', 'New_England_City_and_Town_Area_Divisions60153', 'New_England_City_and_Town_Area__Divisions_Labels46148', 'Off-Reservation_Trust_Lands54343', 'Off-Reservation_Trust_Lands_Labels18066', 'Oklahoma_Tribal_Statistical_Areas50120', 'Oklahoma_Tribal_Statistical_Areas_Labels48357', 'Secondary_School_Districts43718', 'Secondary_School_Districts_Labels36427', 'State_American_Indian_Reservations3874', 'State_American_Indian_Reservations_Labels35471', 'State_Designated_Tribal_Statistical_Areas1347', 'State_Designated_Tribal_Statistical_Areas_Labels45558', 'States', 'States_Labels49388', 'Subbarrios', 'Subbarrios_Labels47498', 'Tribal_Block_Groups26640', 'Tribal_Block_Groups_Labels32973', 'Tribal_Census_Tracts2987', 'Tribal_Census_Tracts_Labels1374', 'Tribal_Designated_Statistical_Areas45836', 'Tribal_Designated_Statistical_Areas_Labels6465', 'Tribal_Subdivisions42483', 'Tribal_Subdivisions_Labels35078', 'Unified_School_Districts15496', 'Unified_School_Districts_Labels28837', 'Urban_Growth_Areas59666', 'Urban_Growth_Areas_Labels47199', 'Voting_Districts56637', 'Voting_Districts_Labels20888', 'Zip_Code_Tabulation_Areas4692', 'Zip_Code_Tabulation_Areas_Labels47657', '_018_State_Legislative_Districts_-_Lower20349', '_018_State_Legislative_Districts_-_Lower_Labels7384', '_018_State_Legislative_Districts_-_Upper25708', '_018_State_Legislative_Districts_-_Upper_Labels34849', '_16th_Congressional_Districts4189', '_16th_Congressional_Districts_Labels3128']
Create an interactive map and add Census data layer to it. You might need to zoom in to see the data layer
In [6]:
Copied!
m = leafmap.Map()
m.add_census_data(wms="Census 2020", layer="States")
m.add_census_data(wms="Census 2020", layer="States_Labels49388")
m
m = leafmap.Map()
m.add_census_data(wms="Census 2020", layer="States")
m.add_census_data(wms="Census 2020", layer="States_Labels49388")
m
Out[6]:
Alternatively, you can use the toolbar to load Census data interactively without coding.