Share the Gallery !Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone

a

aaaaaaaaaaaaaaaaa

Maps are often used to show the distribution of a statistical variable. Here is a description on how to add shapes on maps with the leaflet R library.


Let’s start with basic circle (default propose by leaflet). Please note that since we use here the addCircleMarkers function, the size of the circle are set in pixels. It means that markers will keep always the same size, even when you zoom in or out!

aaaaaaaaaaeeeeeeaaaaaaaaaaaaaa

It is possible to custom the circles. Really helpful since it permits to change it following the value of a statistical variable!

aaaaaaaaaaeeeeeeaaaaaaaaaaaaaa

You can also add circles with the addCircle function. This time, the radius of the circle is defined in meters. It means that its size will change when you zoom on the map!

aaaaaaaaaaeeeeeeaaaaaaaaaaaaaa

Lastly, how to add a rectangle with the addRectangles() function. You have to give the 2 coordinates of 2 opposites corners of the rectangle.

aaaaaaaaaaeeeeeeaaaaaaaaaaaaaa


Not what you are looking for ? Make a new search !


Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz