Skip to content

30 census data

image image image

Uncomment the following line to install leafmap if needed.

1
# !pip install leafmap
1
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

1
census_data_dict = leafmap.get_census_dict()

Print out the list of US Census WMS.

1
2
for key in census_data_dict:
    print(key)

Get the list of layers for a WMS.

1
census_data_dict["Census 2020"]["layers"]

Create an interactive map and add Census data layer to it. You might need to zoom in to see the data layer

1
2
3
4
m = leafmap.Map()
m.add_census_data(wms="Census 2020", layer="States")
m.add_census_data(wms="Census 2020", layer="States_Labels49388")
m

Alternatively, you can use the toolbar to load Census data interactively without coding.