311 Live Map

August 25, 2019 - All

This project attempts to create a ‘live’ map of 311 data for the City of New York. The data is not truly live since the API is updated only once a day. The project has two parts: a Python script that makes an API call and performs data manipulations before converting to a geojson file, and an HTML/Javascript file that handles the rendering of the webmap. The python file calls a Socrata API for the City of New York, converts that data into a Pandas Dataframe, drops unwanted columns and any null values, and then converts to geojson before writing to a new file. The HTML and Javascript calls the Mapbox GL API and renders a basemap that was designed in Mapbox Studio. The geojson file from the Python script is added to the map as a layer and styled by data properties. Additionally, a legend, pop-up on feature-click, and various map details are controlled through the JS and HTML. The user is able to pan and zoom the map, and click on individual features for more details. Ideally, this map updates once a day, and shows the user the most recent 5,000 311 calls made. For automatic updating, please host the files on your webhost of choice. Because the data is updated everyday, the map can look quite different from day to day..

› tags: culture / programming / python /