knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(myMap)
myMap is a package implementing an R6 class constructor to download a map from Stamen API:[http://maps.stamen.com].
The constructor consists of 3 public methods and a private method. initialize method starts the function as it is called with the appropriate arguments. ## Call
A new object will be generated as the constructor ic called:
myMap = MapStamen$new(left = 86.05, bottom = 27.21, right = 87.81, top = 28.76, mapType = "terrain-background", Zoom = 8)
This call generates a new object named "myMap" which is actually a map extracted from Stamen API.
A map which is going to be extracted from Stamen should be defined by a box. The lower-left and upper-rigt points coordinates of the box should therefor be passed as the arguments.
left: Provides the lower-left longtitude of the box. bottom: Provides the lower-left latitude of the box. right: Provides the upper-right longitude. top: Provides the upper-right latitude.mapType: Provides the type of interest for map to be extracted out. It can be one of the following: "terrain", "terrain-background", "terrain-labels", "terrain-lines", "toner", "toner-2010", "toner-2011", "toner-background", "toner-hybrid", "toner-labels", "toner-lines", "toner-lite", "watercolor" .
Each of these types will show a special characteristic of the area of interest. For the details see:[http://maps.stamen.com]
Zoom: Provides the zoom level.
This method will show the myMap:
myMap$showMap()
This is the map of the area of interest for the mapType = "terrain-background".
If we set mapType = "terrain":
myMap = MapStamen$new(left = 86.05, bottom = 27.21, right = 87.81, top = 28.76, mapType = "terrain", Zoom = 8) myMap$showMap()
This method will save a png file of myMap in the working directory.
myMap$saveMap()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.