Before we create a completely custom icon, we need to set up our GeoJSON configuration to allow us to manually create markers in the first place. We'll start by recreating our current markers.
Instructor: [0:00] We have our markers, but that image doesn't necessarily represent what those locations are. Instead, I created this utensils marker, so it shows that it's a restaurant.
[0:07] To use a custom image, we're going to set a new property on our GeoJSON instance. This property is going to be point to a layer, which we're going to set it equal to a function where the first argument is a feature. Our second argument is a lat, long. We want to make sure we include that comma after the property, so it's proper JavaScript.
[0:21] At this point, we're not returning anything. If we look at our map, we actually have no markers. To recreate our markers, we're going to return a Leaflet marker instance, we're going to take our lat, long and we're going to pass it in as an argument. Now, if we look back at our map, we can see that we've recreated our markers
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!