Skip to content

Generating interactive and static maps #97

@HenrikBengtsson

Description

@HenrikBengtsson

Here's an example illustrating how to generate a topology map showing the 300' and the 600' windsocks on Ed Levin using R:

library(leaflet)

m <- leaflet()
m <- m |> addTiles(urlTemplate = "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png")
m <- m |> setView(lat = 37.4611, lng = -121.8625, zoom = 17)

## 300' windsock
m <- m |> addMarkers(lat = 37.4611738, lng = -121.8646301, label = "300ft windsock", labelOptions = labelOptions(noHide = TRUE))

## 600' windsock
m <- m |> addMarkers(lat = 37.4612652, lng = -121.8604359, label = "600ft windsock", labelOptions = labelOptions(noHide = TRUE))

## Open (sic!) interactive leaflet map in web browser
print(m)

To save the same view as a static PNG file, use:

mapview::mapshot2(m, file = "edlevin.png")

This produces:

edlevin

Installation instructions

Assuming modern version of R, install packages using:

$ R
...
> install.packages(c("mapview", "webshot2"))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions