Lab 2: Spatial Analysis and Visualization

Healthcare Access and Equity in Pennsylvania

Author

Arzoo Gupta

Published

March 17, 2026

Assignment Overview

Learning Objectives: - Apply spatial operations to answer policy-relevant research questions - Integrate census demographic data with spatial analysis - Create publication-quality visualizations and maps - Work with spatial data from multiple sources - Communicate findings effectively for policy audiences


Part 1: Healthcare Access for Vulnerable Populations

Research Question

Which Pennsylvania counties have the highest proportion of vulnerable populations (elderly + low-income) living far from hospitals?

Step 1: Data Collection

Load the required spatial data: - Pennsylvania county boundaries - Pennsylvania hospitals (from lecture data) - Pennsylvania census tracts

  1. There are a total of 223 Hospitals in this Dataset across 3445 tracts
  2. The PA counties dataset is in the wgs 84/ Pseudo-Mercator set. The hospitals and census tracts were initially in the WGS 84 coordinate system and have been projected in the same CRS now which is WGS 84/ Pseudo-Mercator

Step 2: Get Demographic Data

Required variables: - Total population - Median household income - Population 65 years and over (you may need to sum multiple age categories)

[1] 70188

# A tibble: 1 × 1
  na_count
     <int>
1       63

I have chosen ACS 2022 Data to conduct this analysis, within this dataset 63 tracts have missing income data. The Median Income across PA is 70,188.


Step 3: Define Vulnerable Populations

Identifying census tracts with vulnerable populations based on TWO criteria: 1. Low median household income (choose an appropriate threshold) 2. Significant elderly population (choose an appropriate threshold)

# A tibble: 1 × 3
  total_tracts vulnerable_tracts pct_vulnerable
         <int>             <int>          <dbl>
1         3446               110            3.2
High Vulnerability Census Tracts in Pennsylvania
Census Tract Total Population Pop. 65+ % 65+ Median Income
Census Tract 9805; Allegheny County; Pennsylvania 19 9 47.4 $27,750
Census Tract 1019; Blair County; Pennsylvania 1,436 636 44.3 $16,429
Census Tract 8047.05; Westmoreland County; Pennsylvania 1,082 471 43.5 $16,029
Census Tract 333; Philadelphia County; Pennsylvania 3,730 1,484 39.8 $49,178
Census Tract 241; Philadelphia County; Pennsylvania 1,401 516 36.8 $16,042
Census Tract 1120.02; Crawford County; Pennsylvania 1,306 479 36.7 $49,342
Census Tract 9513; Jefferson County; Pennsylvania 2,374 867 36.5 $44,492
Census Tract 905.02; Union County; Pennsylvania 6,384 2,280 35.7 $49,367
Census Tract 19; Lehigh County; Pennsylvania 3,974 1,412 35.5 $29,429
Census Tract 6025; Beaver County; Pennsylvania 1,372 486 35.4 $45,114
Census Tract 19; Erie County; Pennsylvania 1,705 602 35.3 $22,219
Census Tract 110.02; Blair County; Pennsylvania 4,052 1,408 34.7 $42,277
Census Tract 5521; Allegheny County; Pennsylvania 1,383 472 34.1 $22,668
Census Tract 282; Philadelphia County; Pennsylvania 4,893 1,649 33.7 $20,674
Census Tract 320; Mercer County; Pennsylvania 4,932 1,658 33.6 $49,540
Census Tract 1; Cambria County; Pennsylvania 978 328 33.5 $12,336
Census Tract 5614; Allegheny County; Pennsylvania 3,566 1,182 33.1 $39,788
Census Tract 114; Cambria County; Pennsylvania 3,000 988 32.9 $43,750
Census Tract 2170.02; Luzerne County; Pennsylvania 2,518 829 32.9 $33,953
Census Tract 1; Erie County; Pennsylvania 1,365 446 32.7 $14,648
Census Tract 1002; Lackawanna County; Pennsylvania 2,901 932 32.1 $22,592
Census Tract 309; Mercer County; Pennsylvania 2,400 762 31.8 $35,647
Census Tract 9622; Indiana County; Pennsylvania 2,261 713 31.5 $47,895
Census Tract 7827; Washington County; Pennsylvania 1,521 478 31.4 $37,409
Census Tract 814; Northumberland County; Pennsylvania 1,754 550 31.4 $40,167
Census Tract 4846; Allegheny County; Pennsylvania 1,815 561 30.9 $35,776
Census Tract 314; Mercer County; Pennsylvania 5,101 1,571 30.8 $52,013
Census Tract 9602.02; Sullivan County; Pennsylvania 918 282 30.7 $51,719
Census Tract 9610.02; Wayne County; Pennsylvania 2,445 746 30.5 $54,269
Census Tract 4200; Allegheny County; Pennsylvania 1,532 460 30.0 $43,333
Census Tract 5615; Allegheny County; Pennsylvania 2,737 820 30.0 $42,461
Census Tract 4323; Allegheny County; Pennsylvania 2,287 685 30.0 $46,994
Census Tract 2006; Venango County; Pennsylvania 4,785 1,432 29.9 $52,153
Census Tract 9714; Warren County; Pennsylvania 1,705 509 29.9 $45,625
Census Tract 201.01; Philadelphia County; Pennsylvania 3,196 951 29.8 $26,256
Census Tract 10; Lawrence County; Pennsylvania 1,505 447 29.7 $48,068
Census Tract 5302; Forest County; Pennsylvania 2,701 802 29.7 $47,132
Census Tract 3306; Clearfield County; Pennsylvania 3,343 987 29.5 $49,659
Census Tract 8025; Westmoreland County; Pennsylvania 1,887 557 29.5 $47,105
Census Tract 5623; Allegheny County; Pennsylvania 2,966 874 29.5 $25,792
Census Tract 214; Somerset County; Pennsylvania 4,299 1,266 29.4 $52,381
Census Tract 105; Lawrence County; Pennsylvania 2,695 792 29.4 $51,639
Census Tract 108; Franklin County; Pennsylvania 3,897 1,132 29.0 $49,912
Census Tract 2173; Luzerne County; Pennsylvania 3,718 1,080 29.0 $51,991
Census Tract 2180; Luzerne County; Pennsylvania 4,041 1,173 29.0 $49,219
Census Tract 8067; Westmoreland County; Pennsylvania 2,697 776 28.8 $39,615
Census Tract 9505; Potter County; Pennsylvania 1,948 559 28.7 $54,779
Census Tract 122.04; Philadelphia County; Pennsylvania 3,915 1,118 28.6 $48,000
Census Tract 9509; Bradford County; Pennsylvania 5,466 1,545 28.3 $51,875
Census Tract 9510; Huntingdon County; Pennsylvania 2,558 723 28.3 $46,908
Census Tract 2170.01; Luzerne County; Pennsylvania 2,357 664 28.2 $49,565
Census Tract 332; Mercer County; Pennsylvania 2,592 727 28.0 $20,007
Census Tract 8060; Westmoreland County; Pennsylvania 2,652 743 28.0 $41,554
Census Tract 6046; Beaver County; Pennsylvania 2,772 772 27.8 $51,944
Census Tract 1111; Crawford County; Pennsylvania 2,842 791 27.8 $25,164
Census Tract 219.02; Somerset County; Pennsylvania 2,138 595 27.8 $52,969
Census Tract 105; Philadelphia County; Pennsylvania 4,251 1,176 27.7 $37,708
Census Tract 324.01; Mercer County; Pennsylvania 1,661 459 27.6 $52,786
Census Tract 4209; McKean County; Pennsylvania 1,843 509 27.6 $53,750
Census Tract 1107; Lackawanna County; Pennsylvania 2,694 744 27.6 $53,715
Census Tract 702.01; Juniata County; Pennsylvania 1,782 492 27.6 $48,958
Census Tract 116; Cambria County; Pennsylvania 2,434 670 27.5 $39,242
Census Tract 4610; Allegheny County; Pennsylvania 946 259 27.4 $54,286
Census Tract 345.01; Philadelphia County; Pennsylvania 4,955 1,356 27.4 $44,094
Census Tract 907; Union County; Pennsylvania 3,378 924 27.4 $42,012
Census Tract 172.01; Philadelphia County; Pennsylvania 2,863 783 27.3 $25,865
Census Tract 280; Philadelphia County; Pennsylvania 4,212 1,135 26.9 $34,143
Census Tract 5653; Allegheny County; Pennsylvania 1,223 329 26.9 $51,008
Census Tract 7727; Washington County; Pennsylvania 2,164 579 26.8 $50,158
Census Tract 301; Clinton County; Pennsylvania 3,176 843 26.5 $45,135
Census Tract 253; Dauphin County; Pennsylvania 4,018 1,066 26.5 $54,698
Census Tract 2601; Fayette County; Pennsylvania 5,018 1,325 26.4 $45,833
Census Tract 4838; Allegheny County; Pennsylvania 2,905 767 26.4 $29,306
Census Tract 5120; Allegheny County; Pennsylvania 2,077 548 26.4 $45,971
Census Tract 4022; Delaware County; Pennsylvania 2,972 784 26.4 $44,951
Census Tract 9607; Bedford County; Pennsylvania 2,855 753 26.4 $48,342
Census Tract 8070; Westmoreland County; Pennsylvania 3,286 865 26.3 $49,583
Census Tract 9708; Warren County; Pennsylvania 2,938 771 26.2 $38,953
Census Tract 2608; Fayette County; Pennsylvania 3,668 962 26.2 $45,667
Census Tract 144; Northampton County; Pennsylvania 2,753 722 26.2 $54,423
Census Tract 1009; Lackawanna County; Pennsylvania 1,573 411 26.1 $40,944
Census Tract 9503; Potter County; Pennsylvania 4,257 1,112 26.1 $54,904
Census Tract 207.22; York County; Pennsylvania 4,254 1,108 26.0 $54,547
Census Tract 4211; McKean County; Pennsylvania 3,609 939 26.0 $45,927
Census Tract 1307; Allegheny County; Pennsylvania 2,068 537 26.0 $30,518
Census Tract 121; Philadelphia County; Pennsylvania 3,052 791 25.9 $51,555
Census Tract 258; Philadelphia County; Pennsylvania 1,845 478 25.9 $48,100
Census Tract 12; Cambria County; Pennsylvania 2,419 625 25.8 $37,530
Census Tract 8064; Westmoreland County; Pennsylvania 2,413 623 25.8 $45,693
Census Tract 120.02; Erie County; Pennsylvania 2,937 756 25.7 $41,764
Census Tract 2617; Fayette County; Pennsylvania 2,336 600 25.7 $51,075
Census Tract 6016; Beaver County; Pennsylvania 1,221 312 25.6 $49,375
Census Tract 16; York County; Pennsylvania 1,659 423 25.5 $19,612
Census Tract 821; Northumberland County; Pennsylvania 2,350 599 25.5 $31,944
Census Tract 113.01; Lycoming County; Pennsylvania 2,052 523 25.5 $54,135
Census Tract 1104; Crawford County; Pennsylvania 2,536 645 25.4 $51,078
Census Tract 5094; Allegheny County; Pennsylvania 5,087 1,293 25.4 $42,344
Census Tract 227.02; York County; Pennsylvania 3,505 890 25.4 $46,886
Census Tract 2117.01; Luzerne County; Pennsylvania 5,078 1,289 25.4 $50,287
Census Tract 6045; Beaver County; Pennsylvania 2,093 531 25.4 $24,948
Census Tract 117; Cambria County; Pennsylvania 2,207 559 25.3 $50,332
Census Tract 3315; Clearfield County; Pennsylvania 1,846 467 25.3 $52,407
Census Tract 8001; Westmoreland County; Pennsylvania 1,023 258 25.2 $23,214
Census Tract 210; Somerset County; Pennsylvania 4,245 1,069 25.2 $53,516
Census Tract 1110; Crawford County; Pennsylvania 2,388 601 25.2 $52,692
Census Tract 2605; Fayette County; Pennsylvania 5,825 1,463 25.1 $53,426
Census Tract 4928; Allegheny County; Pennsylvania 2,429 610 25.1 $36,250
Census Tract 4870; Allegheny County; Pennsylvania 1,614 405 25.1 $43,208
Census Tract 5153; Allegheny County; Pennsylvania 1,488 373 25.1 $29,612
Census Tract 9604; Indiana County; Pennsylvania 3,442 861 25.0 $51,951
Note:
High vulnerability defined as 65+ population ≥ 25% and median income < $55,000

Based on my previous analysis of the median income across all census tracts in Pennsylvania I arrived at a decision to identify all census tracts that fall below the IQ 1 or in the bottom 25% of the state will be identified as vulnerable.

The national average for 65+ population is approximately 17% and Pennsylvania’s state average sits around 19%. Setting the threshold at 25% means I am flagging tracts that are meaningfully above both the national and state baseline, representing communities where elderly residents are the dominant demographic rather than just a notable one.

A 110 tracts or 3.2% of tracts in all of PA classify as vulnerable based off of my definition.


Step 4: Calculate Distance to Hospitals

For each vulnerable tract, calculate the distance to the nearest hospital. *Note I converted all the CRS to albers to get the most accurate distance projected as state plane doesn’t work here because PA has two zones.

[1] 5070
  avg_distance_mi max_distance_mi tracts_over_15mi
1            4.83           19.32                9
  1. The average distance to the nearest hospital for vulnerable tracts only is 4.83 miles
  2. The maximum distance is 19.32 miles
  3. There are 9 tracts that I have identified that are more than 15 miles away from a hospital

Step 5: Identify Underserved Areas

Define “underserved” as vulnerable tracts that are more than 15 miles from the nearest hospital.

  total_vulnerable underserved pct_underserved
1              110           9             8.2

There are 9 identified tracts which are underserved, which is 8.2% of the vulnerable tracts. 9 tracts is actually not that surprising for PA given the state’s hospital density. Pennsylvania has one of the highest concentrations of hospitals per capita in the US, particularly due to the large academic medical center networks in Philadelphia and Pittsburgh (Penn Medicine, Jefferson, UPMC, Allegheny Health). These systems have enough satellite facilities and community hospitals spread across the state that most tracts fall within a reasonable distance.


Aggregate to County Level

Use spatial joins and aggregation to calculate county-level statistics about vulnerable populations and hospital access.

# A tibble: 6 × 6
  COUNTY_NAM.x vulnerable_tracts underserved_tracts pct_underserved
  <chr>                    <int>              <int>           <dbl>
1 BRADFORD                     1                  1             100
2 CLEARFIELD                   4                  4             100
3 DAUPHIN                      3                  3             100
4 FOREST                       4                  4             100
5 JUNIATA                      5                  5             100
6 SULLIVAN                     4                  4             100
# ℹ 2 more variables: avg_dist_to_hospital <dbl>, total_vulnerable_pop <dbl>
# A tibble: 5 × 6
  COUNTY_NAM.x vulnerable_tracts underserved_tracts pct_underserved
  <chr>                    <int>              <int>           <dbl>
1 CRAWFORD                     6                  1            16.7
2 DAUPHIN                      3                  3           100  
3 FOREST                       4                  4           100  
4 CLEARFIELD                   4                  4           100  
5 POTTER                       4                  3            75  
# ℹ 2 more variables: avg_dist_to_hospital <dbl>, total_vulnerable_pop <dbl>

Which 5 counties have the highest percentage of underserved vulnerable tracts? Bradford, Clearfield, Forest, Juniata, and Sullivan all have 100% of their vulnerable tracts classified as underserved — every single vulnerable tract in these counties is more than 15 miles from a hospital. Dauphin is also notable at 100% with 3 tracts.

Which counties have the most vulnerable people living far from hospitals? From the second table Crawford, Dauphin, Forest, Clearfield, and Potter have the most vulnerable people living far from hospitals. Crawford is interesting here because it has 6 vulnerable tracts but only 1 underserved, suggesting a larger overall vulnerable population even if most tracts are within range.

Are there any patterns in where underserved counties are located? Yes, the pattern is very clear and geographically coherent. Almost all of these counties — Forest, Clearfield, Sullivan, Bradford, Juniata, Potter — are in north-central and central Pennsylvania, which is the most rural and mountainous part of the state. This region is sometimes called the Pennsylvania Wilds and is characterized by very low population density, limited road infrastructure, and a long history of hospital closures and consolidations. Dauphin being on this list is somewhat surprising given it contains Harrisburg, but this likely reflects specific rural tracts on the outskirts of the county far from the urban core.


Step 7: Create Summary Table

Create a professional table showing the top 10 priority counties for healthcare investment.

Top 10 Priority Counties for Healthcare Investment in Pennsylvania (2022)
County Vulnerable Tracts Underserved Tracts % Underserved Avg. Distance to Hospital Vulnerable Population
Dauphin 3 3 100% 19.3 mi 12,054
Forest 4 4 100% 18 mi 10,804
Sullivan 4 4 100% 16.9 mi 3,672
Bradford 1 1 100% 16.7 mi 5,466
Clearfield 4 4 100% 16.1 mi 10,378
Juniata 5 5 100% 16 mi 8,910
Potter 4 3 75% 13 mi 10,101
Crawford 6 1 16.7% 6.1 mi 13,848
Huntingdon 2 0 0% 14.2 mi 5,116
Northumberland 2 0 0% 10.6 mi 4,104
Note:
Priority score weighted: 50% underserved rate, 30% average distance, 20% underserved tract ratio.

Part 2: Comprehensive Visualization

Map 1: County-Level Choropleth

Create a choropleth map showing healthcare access challenges at the county level.


Map 2: Detailed Vulnerability Map

Create a map highlighting underserved vulnerable tracts.


Chart: Distribution Analysis

Create a visualization showing the distribution of distances to hospitals for vulnerable populations.


Part 3: Bring Your Own Data Analysis

Reading layer `Schools' from data source 
  `C:\Users\arzoo\OneDrive - PennO365\Documents\GitHub\PPA-Portfolio\Labs\Lab_2\Data\Schools.geojson' 
  using driver `GeoJSON'
Simple feature collection with 490 features and 14 fields
Geometry type: POINT
Dimension:     XY
Bounding box:  xmin: -75.2665 ymin: 39.90781 xmax: -74.97057 ymax: 40.12974
Geodetic CRS:  WGS 84
Reading layer `Bike_Network' from data source 
  `C:\Users\arzoo\OneDrive - PennO365\Documents\GitHub\PPA-Portfolio\Labs\Lab_2\Data\Bike_Network.geojson' 
  using driver `GeoJSON'
Simple feature collection with 5225 features and 8 fields
Geometry type: LINESTRING
Dimension:     XY
Bounding box:  xmin: -75.26927 ymin: 39.87528 xmax: -74.96572 ymax: 40.124
Geodetic CRS:  WGS 84
[1] 490
[1] 150307
[1] 5225
[1] 2272
[1] 2272
[1] 2272

What dataset did you choose and why? I chose three datasets for this analysis: Philadelphia Schools, Crime Incidents (Part 1 & Part 2), and the Bike Network, all sourced from OpenDataPhilly. I chose this combination because school safety is a pressing urban policy issue — understanding whether children traveling to school are passing through high-crime areas and whether adequate bike infrastructure exists has direct relevance for safe routes to school programs and infrastructure investment decisions.

What is the data source and date? All datasets were obtained from OpenDataPhilly (https://opendataphilly.org). The crime dataset contains Part 1 and Part 2 incidents reported by the Philadelphia Police Department for 2022. The schools and bike network datasets are maintained by the City of Philadelphia and reflect current infrastructure.

How many features does it contain? The schools dataset contains 490 schools, the crime dataset contains 150307 incidents, and the bike network contains 5,225 road segments.

What CRS was it in? Did you need to transform it? The schools and bike network were loaded in WGS 84 (EPSG 4326). The crime CSV used longitude/latitude coordinates also in WGS 84. All three layers were transformed to Pennsylvania State Plane South (EPSG 2272), which measures in feet and is the most appropriate projection for distance-based analysis within Philadelphia.


Research question

Are Philadelphia school zones safe for children walking and biking to school, and do schools located in high-crime areas have adequate bike infrastructure to support safe active transportation?”

What this analysis will show:

  • How many crime incidents occur within 1,000ft of each school

  • Which schools are in the highest crime zones

  • Whether bike infrastructure exists near high-crime schools

  • Whether schools lacking bike infrastructure are also in high-crime areas — the double burden of unsafe streets and inadequate infrastructure


  1. Conduct spatial analysis
  total_schools avg_crime max_crime high_crime_schools pct_with_bike
1           490     234.7      2229                122          80.6
  double_burden
1            19
Top 10 Philadelphia Schools by Crime Incidents Within 1,000ft (2022)
School Name Grade Level Crime Count Bike Infrastructure
FREIRE CHARTER SCHOOL MIDDLE SCHOOL 2229 Yes
FREIRE CHARTER SCHOOL HIGH SCHOOL 2229 Yes
K012 KIDS SCHOOL PRE-K/ELEMENTARY 2082 Yes
REVOLUTION SCHOOL HIGH SCHOOL 1547 Yes
CONWELL, RUSSELL MIDDLE SCHOOL MIDDLE SCHOOL 1046 Yes
JOHN B STETSON MIDDLE SCHOOL MIDDLE SCHOOL 974 Yes
JOHN B STETSON MIDDLE SCHOOL NA 974 Yes
WILLARD, FRANCES E. SCHOOL ELEMENTARY SCHOOL 802 Yes
LOGAN HOPE SCHOOL ELEMENTARY/MIDDLE 801 Yes
STUDENT TRANSITION CENTER ELEMENTARY/MIDDLE/HIGH 730 Yes
Note:
Crime incidents include Part 1 and Part 2 offenses reported by Philadelphia Police Department

The analysis reveals that Philadelphia school zones face significant crime exposure, with an average of 234.7 crime incidents recorded within 1,000 feet of each of the city’s 490 schools. The maximum crime count of 2,229 incidents near Freire Charter School indicates that some schools are located in extremely high-activity crime corridors, particularly in dense urban neighborhoods. Of the 490 schools, 122 — roughly 25% — fall into the high crime category based on the 75th percentile threshold, suggesting that elevated crime exposure is not an isolated problem but a systemic one affecting a substantial portion of Philadelphia students. Encouragingly, 80.6% of schools have bike infrastructure within their safety zone, however 19 schools face a double burden of both high crime and no bike infrastructure, making them the highest priority for targeted safety intervention. Overall the findings suggest that while bike infrastructure coverage is relatively strong across the city, crime exposure remains a widespread challenge that warrants targeted investment in the most heavily affected school zones.

Finally - A few comments about your incorporation of feedback!

The comment and the feedback I received in the previous assignment was to not include setup code within the assignment so it reads like a professional document, so i have attempted to remove it and have also edited the questions a bit more so it reads more coherently