Description Usage Arguments Examples
The get_background
function loads and plots pre-rendered map background.
1 2 | get_background(xy, map_data = "extdata", mapdb_name = "MapID.db", proj,
init_proj, options_list = NULL)
|
xy |
a data frame of network graph's coordinates, with columns labelled 'Longitude' and 'Latitude'. |
map_data |
a path to the directory including maps. |
mapdb_name |
a character string with the name of the map database. |
proj |
a string specifying the geographic projection of the network graph, e.g. "+init=epsg:4326". |
init_proj |
a string specifying the geographic projection of the map database (by default "+init=epsg:4326"). |
options_list |
a set of mainly graphical parameters used by the rendering engine:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | ###########################################################
# Loading the package
library(gisserver)
# Generating artificial points
Longitude <- runif(100, min = 20.9, max = 21.05)
Latitude <- runif(100, min = 52.2, max = 52.25)
xy <- as.data.frame(cbind(Longitude, Latitude))
# Setting the projection of the graph coordinates (proj) and the projection of the underlying map (init_proj)
proj = "+init=epsg:4326"
init_proj = "+init=epsg:4326" # default OSM coordinate reference system
options_list <- list(mscale = 29000,
url = NULL,
wld = FALSE,
dpi = 200,
paper = NULL,
margin = 0.01,
size = NULL,
xmstyle = "C:/GIS_data/osm_mapnik/gis.xml",
output = "map.png",
tiles = FALSE,
just_tiles = FALSE,
force_rend = TRUE)
# Fetching the map background
get_background(xy = xy,
map_data = "extdata",
mapdb_name = "MapID.db",
proj = proj,
init_proj = init_proj,
options_list = options_list)
# Plotting the points on the background
points(xy, col = 'red', lwd = 3)
###########################################################
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.