Skip to contents

Convenience wrapper around sv_static_url() that always returns an HTML <img> tag.

Usage

sv_static_img(
  lat,
  lng,
  api_key = Sys.getenv("GOOGLE_MAPS_API_KEY"),
  size = "640x400",
  heading = 0,
  pitch = 0,
  fov = 90,
  radius = 50,
  ...
)

Arguments

lat

Numeric. Latitude.

lng

Numeric. Longitude.

api_key

Character. Google Maps API key. Defaults to GOOGLE_MAPS_API_KEY environment variable.

size

Character. Image dimensions as "WIDTHxHEIGHT". Max "640x640" on the free tier. Default: "640x400".

heading

Numeric. Camera heading in degrees (0-360). Default: 0.

pitch

Numeric. Camera pitch in degrees (-90 to 90). Default: 0.

fov

Numeric. Field of view in degrees (0-120). Default: 90.

radius

Numeric. Search radius in metres to find a panorama near lat/lng. Default: 50.

...

Additional attributes passed to the <img> tag (e.g. style = "border-radius:8px").

Value

An HTML <img> tag (class "shiny.tag").

Examples

# An <img> tag ready to drop into an R Markdown document
sv_static_img(48.8584, 2.2945, api_key = "YOUR_KEY")
#> <img src="https://maps.googleapis.com/maps/api/streetview?size=640x400&amp;location=48.8584,2.2945&amp;heading=0&amp;pitch=0&amp;fov=90&amp;radius=50&amp;key=YOUR_KEY" width="100%"/>

sv_static_img(48.8584, 2.2945, style = "border-radius:8px",
              api_key = "YOUR_KEY")
#> <img src="https://maps.googleapis.com/maps/api/streetview?size=640x400&amp;location=48.8584,2.2945&amp;heading=0&amp;pitch=0&amp;fov=90&amp;radius=50&amp;key=YOUR_KEY" width="100%" style="border-radius:8px"/>