Forum Discussion
How to create census tract maps in Power BI
Bryan_Schmidt I'm unable to read census tract info into Power Bi, but here's how to do it with shapefiles.
1. For Oregon, download the shapefile from here (Select 'Census Tracts', then 'State'): https://www.census.gov/cgi-bin/geo/shapefiles/index.php?year=2023&layergroup=Census+Tracts )
2. Use mapshaper to convert the shapefiles to topojson: https://mapshaper.org/ Note: Your shapefile map consists of several files. Select at least the .dbf and .shp files, and if available, also the .shx and .prj files. To select multiple files, hold the CTRL button while selecting the files and drag/upload them to mapshaper. Export as topojson. This creates a single file of Oregon census tracts.
3. Import the JSON file into Power BI, and select the shapemap visulization. Under the 'Format Visual' tab > Visual > Map Settings > Map type, select 'Custom map' (last option) in the drop down menu and under 'Add a map type' select your json file. The 'Projection' drop down option should be Mercator.
4. Format the 'Geography' variable. Census tract data downloaded from Census.gov is in this format: 1400000US41001950100. You'll need to extract the digits after 'US' in order for Power BI to recognize it: 41001950100 (41=Oregon). In the table view in Power BI, save this field as text and select 'Place' as the Data Category. In the Report view, drag the Census Tract field to Location and your variable of interest to Color Saturation to complete your visualization.
5. Happy mapping!
Thanks for the detailed instructions. Given memory limitations with PBI map visuals, can you import JSON census tract files for the entire country, or does it only work state by state?