Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Radius of AddCircle in Leaflet for R

Tags:

r

leaflet

leaflet() %>%
addTiles() %>%
addCircles(lng = -72.680663, lat = 42.448013, radius = 10, color = "#03F",    weight = 3)

Hi! Our group is using the leaflet package. We are trying to figure out what units the radius argument takes in the addCircles() function.

According to the documentation, radius is: a numeric vector of radii for the circles; it can also be a one-sided formula, in which case the radius values are derived from the data (units in meters for circles, and pixels for circle markers)

Is there a way for us to set the units the radius is in? What is the default unit radius is set it?

Circle that shows up with radius of 10 entered:

enter image description here

like image 801
Caelana Avatar asked Sep 18 '25 09:09

Caelana


1 Answers

It looks like meters. According to the Wikipedia, the Astrodome has a 110m radius, and if you plot that:

leaflet() %>%
  addTiles() %>%
  addCircles(lng = -95.407778, lat = 29.685, radius = 110) 

it lines up almost perfectly.

enter image description here

like image 86
beanumber Avatar answered Sep 21 '25 01:09

beanumber