Where to Prioritize Emergency Rental Assistance to Keep Renters in Their Homes
This repo contains the code for the map visualization in the Where to Prioritize Emergency Rental Assistance to Keep Renters in Their Homes feature. This webtool allows users to determine which neighborhoods have the highest need for rental assistance as measured by our Emergency Rental Assistance Priority Index. This index is comprised of three subindices: housing instability risk, COVID-19 impact, and equity. For more details about what each of these subindices are comprised of, see here.
The feature uses Mapbox to power the map and tippecanoe and some d3 cartography modules to generate the mbtiles for the map.
Data inputs
The following files are sourced as inputs for the visualization:
housing_index_state_adj_feature.geojson- a geojson of Census Tracts that contains several geographic identifiers (GEOID,state_name,county_name,state_fips,county_fips) along with percentile values for the overall Emergency Rental Assistance Priority index and the three subindices and values for each of the components that comprise the indices.counties.geojson- a geojson of county boundaries and geographic identifierscoc_geographies_states_split.geojson- a geojson of Continuum of Care boundaries and names and ID numbers. Continuums of Care that spanned more than one state were split along state boundaries and given names such asXXX CoC (Alabama part)andXXX CoC (Arkansas part)though each part has the same original CoC number.geos.csv- a csv mapping Census tracts to county names, county FIPS, state names, and state FIPS. This is used to display the name of the county and state a selected tract falls in.
Data processing scripts
selectColumns.R- this script ingests the source files and outputs a geojson with the minimum necessary columns retained and with percentile numbers converted into integers. It also creates a .csv file that maps each tract to the name and abbreviation of the state and the name of the county it falls in. Finally, it fixes a capitalization error in county names. Note: this script uses theurbnmaprR package to map Census tracts to their states and counties.- Inputs:
housing_index_state_adj_feature.geojson,counties.geojson - Outputs:
housing_data_index-subset.geojson,geos.csv,counties-final.geojson
- Inputs:
reshapeGeojsons.py- this script returns a json file with the calculated bounding box for each county and each Continuum of Care. This is needed for the search functionality to tell Mapbox where to shift the map to after the user selects a county or CoC.- Inputs:
counties-final.geojson,coc_geographies_states_split.geojson - Outputs:
county_bboxes.json,coc_bboxes.json
- Inputs:
makeMaptiles.sh- this script generates the mbtiles for Mapbox to insure the data are available for all of the zoom levels we need. It also adds a top-level numeric identifier for each Census tract which is needed to allow individual tracts to be highlighted when mousedover on the map.- Inputs:
housing_data_index-subset.geojson,coc_geographies_states_split.geojson - Outputs:
housing_data_indicators-id.mbtiles,coc.mbtiles
- Inputs:
How to update
- First run
selectColumns.Rfrom within the\datasubdirectory. The outputs generated by this script are taken as inputs to the other two data processing scripts. - Run
makeMaptiles.shfrom within the project root directory. AftermakeMaptiles.shis run, be sure to upload the two.mbtilefiles it produces to Mapbox. (Note:reshapeGeojsons.pydoes not need to be rerun unless the boundaries of a county or CoC has changed.)