I want to add a really simple legend to my mapview-map. I have a sfc_MULTILINESTRING-object called path and a sfc_POINT-object called places. I just wanted to have a legend that shows a line and says "path" and a point that says "Points of Interest". I dont really know how I could implement this in mapview. The bit of code at the moment looks like this:

mapview::mapview(path, lwd = 7) + mapview(places)

1 Answer 1


Combine your two shapes into a list, then name them with layer.name. This is listed in their advanced section of documentation

        layer.name = c("path","Points of Interest"))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.