Python Dash app for NYC Tree Health

How to create a dash choropleth map to filter your visualization

Justin Morgan Williams
7 min readMar 29, 2023
Photo by Lerone Pieters on Unsplash

Background

Think of all the trees in the New York City (NYC) that help sequester carbon so that New Yorkers can breath some semblance of clean air. Without them, we would be screwed, bottom line — NYC Tree Health is important.

In 2015 NYC Parks & Recreation organized a large scale data collection conducted by volunteers and staff, which included tree species, diameter and health perception. This data is publicly available on NYC Open Data.

I wanted to create an interactive dashboard to analyze overall tree health, and see if steward quantity has a positive impact. I also wanted to implement this without using any local data, and filter the subsequent findings via map. I figured Dash would be up for the challenge, So here goes!

Data

Socrata API

As stated prior, I wanted to write code that pulls all needed data directly from the web, without a need for local storage, this is where the Socrata API comes in handy. It enables one to to use “Socrata Query Language” or SoQL to query the data, obtaining only the information absolutely necessary for analysis. This eliminates the need to download the entire dataset (in…

--

--

Justin Morgan Williams

Data scientist passionate about the intersectionality of sustainability and data.