1. 44
    Add Another Restaurant Attribute with a GeoJSON Property and Display it in a Leaflet Popup
    31s

Add Another Restaurant Attribute with a GeoJSON Property and Display it in a Leaflet Popup

Colby Fayock
InstructorColby Fayock
Share this video with your friends

Social Share Links

Send Tweet

When looking for restaurants, people like to know if the restaurant serves food to their dietary needs. Maybe they're vegan or lactose intolerant -- either way, we can add another data attribute that allows us to display that information.

Create a new data attribute in our the properties of each location in our GeoJSON file for another category like Dietary Restrictions and set up our popup to include that information!

Click here for exercise instructions

Instructor: [0:00] By looking at this restaurant, we can tell what they have there, but we can't tell if they're vegan-friendly or not. We can add another attribute inside of our locations file where we can create a new property called vegan. If this location is actually vegan, we can set that to true.

[0:11] Inside of our code, we're going to copy the delivery properties since that's similar with the true and false values. Where inside delivery, we're going to say vegan-friendly. We're going to destructure that vegan property and change that delivery variable to vegan.

[0:23] Now on our map, we can see that if we look at DC Pizza, it says that vegan-friendly is equals yes. Since on Pi Pizzeria, we didn't set that, it's not vegan-friendly.