-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
š» Summary
For this sprint, youāll build upon the heat map created last week by adding a heat layer that displays intensities of a given attribute (e.g. student, teacher, project counts). To do this, you will use a heatmap layer from MapLibre, our map provider. Each dot will represent a school, and the size of the dot is dependent on the quantity of the measured statistic.
Goals of this sprint:
- Learn how to add a layer to the map that is responsive to the view of the map (zoom in and out), and properly displays useful intensity data.
- Retrieve school data from the database, and place a dot at the schoolās longitude and latitude of appropriate size depending on the total counts for that school (# students, teachers, projects).
āļø Setup
Before starting:
- PLEASE: **Pull the latest changes from
main:git pull - Create a new branch for this sprint.
- Install dependencies.
- Run the dev server and verify the site builds.
- Confirm everything runs.
If you experience problems, check your.envis up to date!
š§ Implementation
Step 1: Study MapLibreās heatmap documentation & our existing map
- Look through our codebase and learn how the previous group implemented the map component. It may be useful to look at how the county borders are drawn on the map as you will need to add your own layer to this map for your sprint.
- For reference, we are using mapcn for our map systems, which is built using MapLibre maps. mapcn is very well-integrated with React, Tailwind, and shadcn, which is the primary reason that we decided to go with it instead of mapbox. It may be useful to look over the code examples that can be found in the mapcn documentation to see how to use the mapās features. Also refer to the specific API documentation.
Step 2: Retrieve school data
- Thanks to a previous teamās work, every school in our database has corresponding longitude and latitude values for each entry. You can find this in the
schoolstable. Weāre enforcing that every school thatās uploading has a matching longitude and latitude coordinate pair. - For your heat map, there will be two settings for the data that is displayed: counts and year.
- Counts: dropdown that adjust what exactly the intensity is displaying for each school. This may be the number of students, number of teachers, or number of projects at a given school.
- Year: dropdown that allows the user to select which year of data they want to display on the heat map. Pretty straightforward and similar to the line/bar chart visualizations.
- For a selected year, youāll fetch all of the schools that have entries for that year (which includes their longitude and latitude for plotting on the map) and their respective counts for the selected count type. For example, if I select ā2025ā and ā# of students,ā the query should return all of the schools that participated in 2025 and the number of students that participated at each of those schools in 2025.
- Note which branch of the Neon database you are using. Make sure that there are entries for schools across multiple years and also participation data for those schools for each of the types of counts (students, teachers, projects).
Step 3: Implement the heat layer
- Pull up the MapLibre heatmap documentation again. In order to display the data you just fetched from the database on the map, youāll need to convert this data into a geojson format. Hereās the geojson data from the earthquake example shown on MapLibreās site.
- Either figure out a way to easily convert this data or find a simple library that will accomplish this for you. We donāt anticipate this being too tricky.
- Once you have the schools data in a geojson object, youāll be able to add it to the heat layer. Again, look at the documentation for how they inputted this data.
- You may want to adjust the circle radiuses/weight to different values so that weāre able to display a wide enough range of data, and so that the heat map is a usual insight into the number of participants at one school versus another.
Step 4: Finishing touches
- After your heat layer is displaying intensities, check that it works for every type of count over multiple different years. As you zoom out, the school dots should become colored regions of heat that correspond to the intensity of participants in a region.
- Double-check that the schools are plotted correctly on the map. If something is off, determine if itās an issue with the long/lat stored in the database or with your heatmap layer. And if the latter, please fix it.
š Acceptance Criteria
- UI matches Figma exactly
- Code runs locally without errors and builds successfully
- Map displays the entirety of Massachusetts with view controls
- Heat layer repositions as the user adjusts the window
- The size of a schoolās dot represents the count for that school
- Schools are plotted in the correct spots according to their long/lat stored in the database
- Heatmap layer displays meaningful and accurate information about all school for a given year
- Merge via PR
āļø Questions
If you get stuck or have questions:
- DM Dan or Shayne on Slack
- Come to office hours or ask during a hack night
- Ask questions during team meetings ā weāre here to help!
š Resources
- Figma:
- Tailwind CSS
- shadcn/ui
- npm package manager
- mapcn
- MapLibre heatmap layer
Reactions are currently unavailable