mapping out nyc shooting data with carto



After my initial explorations of NYC shooting incident data using Tableau Public and Gephi, I wanted to map out where the shootings were occurring.  I was also interested in seeing if I could find a way to compare the economic status of a given area within the City with the numbers of shootings that occurred there.  My hypothesis was that areas with higher shooting rates would likely be areas with lower incomes. To create my map I utilized Carto.  Carto is a location intelligence platform that allows you to analyze geospatial data. Carto offers a free one year trial that I was able to take advantage of for mapping out and analyzing my data.  

CARTO announces data enhancements to unlock use cases for Location  Intelligence – Geospatial World
I used Carto to map out my data


My first step was to upload my data set into Carto. After uploading the CSV file, Carto automatically synthesized the data to pull out the locations of the shootings and generated a map of them as seen in the visualization below.

Screenshot of initial map showcasing shooting incidents in NYC from 2006-2020

From there I wanted to create distinct geographical boundaries in order to more easily visualize where the majority of the shootings were occurring. First I uploaded a GeoJSON file of an NYC borough map that I found on NYC’s Open Data website and added it as a new layer to my map.  Using the Intersect & Aggregate analysis tool in Carto, I was able to create a map with a color gradient that compared the levels of shooting incidents within each of the five boroughs. In the resulting visualization however, the areas were too broad, and I couldn’t really narrow in on the specific locations with the highest number of shootings. 

Screenshot of the Carto map showing shooting incidents by borough

I redid the same analysis using a map of NYC police precincts that I also found on NYC’s Open Data site. Breaking the map down into precincts created more, smaller areas for comparison versus the larger five boroughs. As represented in the visualization below, I was able to more accurately pinpoint the geographic areas within the City that saw the highest incidents.

As shown in this screenshot, breaking the data down by precinct provided more areas for comparison vs. by borough


Now that I had a map that showcased where these incidents were occurring, my next step was to try and find data that illuminated the financial status of these locations. After searching and failing to find a map that showed income or tax information for each area, I found a map of New York City Housing Authority (NYCHA) building developments. Understanding that these housing developments are predominately for lower-income residents and see a disproportionate percentage of violent crimes, I was curious to see if layering it onto the shooting locations would uncover any correlations. I also felt this was a good barometer of economic status over time, since the shooting data spans from 2006 to present. While certain neighborhoods may have shifted economically during this period, these housing developments have been there the entire time, relatively unchanged.

After layering the NYCHA units onto my map, I could see that indeed many of those housing developments were concentrated in areas with higher levels of shooting incidents. The resulting visualization seemed to support my initial hypothesis that lower income areas see the majority of gun violence. The next step was to format the visualization in a way that best showcased this information.


One of the first edits I made was choosing the colors to best show the scale of shooting incidents across the precincts. Ultimately, I found the red gradient to be most effective in demonstrating the different levels. Under the color gradient options I set the bucket level to 7 to fully highlight the scale of shooting numbers across the City. Changing the border color to black helped to distinguish the individual precincts. For the NYCHA housing developments I wanted a color that contrasted with the reds to make sure their locations were emphasized. After consulting with my professor, we found that a bright blue stood out against the reds and allowed future users of the visualization to easily see where the housing units were in comparison with the number of shootings.

Carto does allow you to add some widgets to your visualization that can highlight different aspects of your data. However, I didn’t feel they added value towards what I was trying to represent, and didn’t really work to make my map more interactive. There is also a tool that allows you to create a legend on your map, which I did find useful to include. Within the legend I was able to label the color gradient, show the average number of shootings and identify the different areas as police precincts so users would be able to comprehend what the map was depicting. After consulting with my professor I also included a key in the legend for the blue NYCHA developments, again so users could understand what they were looking at. One drawback with Carto is that you cannot title your map. However, you can title the legend, and it can serve as a place to provide that descriptive information.

There are several base map formats that you can choose from in Carto. After a discussion with my professor, I picked the Voyager (Lite) base map since it clearly showed the geographic location in question. The Lite version did not have all of the city/town names on it, which eliminated excess clutter and focused the eye on the NYC area in question. Finally I added a pop-up in the borough layer so that anyone unfamiliar with the City would be able to click on a given precinct and a pop-up window would show them what borough that precinct was in.

Final visualization of shooting incidents by precinct with overlay of NYCHA housing developments


Overall I was satisfied with my final map. Layering it with the NYCHA housing developments did seem to validate my initial thoughts that shooting rates and economic status are related. Finding a dataset that better showcases the financial status of these areas would help to substantiate my findings even further.