symbolGoogleMaps: Create a plot of SpatialPointsDataFrame data using SVG...

Description Usage Arguments Value Author(s) See Also Examples

Description

Uses Google Maps to visualize data in a SpatialPointsDataFrame as a collection of customizable SVG symbols. See the following for more information: https://developers.google.com/maps/documentation/javascript/symbols

Usage

 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
44
45
46
47
48
49
50
51
52
53
54
55
56
symbolGoogleMaps(SP, 
                 filename = '',
                 zcol = 1,
                 add = FALSE, 
                 previousMap = NULL,
                 symbolPath = 'google.maps.SymbolPath.CIRCLE',
                 minScale = 5,
                 zcolIndexBase = mean(sqrt(SP@data[,zcol]/pi)*2,na.rm = TRUE),
                 symbolFillColor = "red",
                 symbolFillOpacity = 0.7,
                 strokeColor = "white",
                 strokeOpacity = 1,
                 strokeWeight = 1,
                 clickable = TRUE,
                 draggableMarker = FALSE,
                 flat = TRUE,
                 visible = TRUE,
                 zIndex = "null",
                 map.width = "100%",
                 map.height = "100%",
                 layerName = "",
                 layerNameEnabled = TRUE,
                 layerGroupName = FALSE,
                 control.width = "100%",
                 control.height = "100%",
                 zoom = 15, 
                 fitBounds = TRUE,
                 mapTypeId = 'HYBRID', 
                 disableDoubleClickZoom = FALSE, 
                 draggable = TRUE, 
                 keyboardShortcuts = TRUE, 
                 mapTypeControlOptions = 'DEFAULT',
                 navigationControl = TRUE,
                 navigationControlOptions = 'DEFAULT', 
                 scaleControlOptions = 'STANDARD',
                 noClear = FALSE,
                 scrollwheel = TRUE, 
                 streetViewControl = FALSE,
                 control = TRUE,
                 InfoWindowControl = list(map=map, event="click",position="event.latLng",
                                          disableAutoPan=FALSE, maxWidth=330,
                                          pixelOffset="null",zIndex="null"),
                 funcSetInfoWindowText=NULL,
                 funcSetMarkerTitleText=NULL,
                 map = "map",
                 mapCanvas = "map_canvas",
                 css = "",                                     
                 api = "https://maps.googleapis.com/maps/api/js?libraries=visualization",
                 openMap = TRUE,
                 trafficLayerEnabled = NULL,
                 trafficLayerName = "Traffic",
                 transitLayerEnabled = NULL,
                 transitLayerName = "Transit",
                 bicycleLayerEnabled = NULL,
                 bicycleLayerName = "Bicycle",
                 ...) 

Arguments

SP

object of Spatial-class with associated coordinate reference systems

filename

the name of the output htm or html file. If filename is not defined the function creates temporary file.

zcol

variable column name, or column number after removing spatial coordinates from x@data: 1 refers to the first non-coordinate column

add

logical; if TRUE the result of the function will be a list stored as variable in the R. It is possible to combine more layers in the one plot, previously saved output from plotGoogleMaps should be given in the previousMap attribute.

previousMap

previously saved variable from plotGoogleMaps or bubbleGoogleMaps when attribute add is TRUE. It is solution for combining more than one layers in the one plot.

symbolPath

Google Maps symbol path. Default is google.maps.SymbolPath.CIRCLE. If 1 value is specified, it is used for all data points. Can also specify a vector of different symbol paths, one for each point

minScale

Number of pixels to use for the minimum value in zcol

zcolIndexBase

Denominator used to normalize zcol values. Default is mean(sqrt(SP@data[,zcol]/pi)*2,na.rm = TRUE)

symbolFillColor

Fill color for symbol interior. Default is 'red'. Can also supply a vector to specify a different color for each symbol

symbolFillOpacity

Opacity of symbols. Range is 0-1, default is 0.7. Can also supply a vector to specify a different opacity for each symbol

strokeColor

Stroke color for symbol outlines. Default is 'white'. Can also supply a vector to specify a different stroke color for each symbol

strokeOpacity

Stroke opacity for symbol outlines. Range is 0-1, default is 1. Can also supply a vector to specify a different opacity for each symbol

strokeWeight

Stroke weight for symbol outlines. Default is 1. Can also supply a vector to specify a different stroke weight for each symbol

clickable

indicates whether this symbol (point) handles click events

draggableMarker

if TRUE, the symbol can be dragged

flat

if TRUE, the marker shadow will not be displayed

visible

if TRUE, the marker is visible

zIndex

the zIndex compared to other polygons. This can be specified as a vector of length(SP).

map.width

the width of the map. Can be in percent or in pixels (px)

map.height

the height of the map. Can be in percent or in pixels (px)

layerName

the name of the layer. Layer name appears on the check box for switching layer of and on in output htm.

layerNameEnabled

controls whether the layer is enabled (shown) when the map is loaded. Default is TRUE

layerGroupName

character string to show above control in legend. Useful for identifying groups of map layers. Default is FALSE to indicate no grouping text to display

control.width

the width of the part of htm for controlling layer (legend, opacity,...) Can be in percent or in pixels (px).

control.height

the height of the part of htm for controlling layer (legend, opacity,...) Can be in percent or in pixels (px).

zoom

the initial Map zoom level.Zoom levels between 0 (the lowest zoom level, in which the entire world can be seen on one map) to 19 (the highest zoom level, down to individual buildings) are possible within the normal maps view. Argument fitBounds should be FALSE.

fitBounds

sets the maps to fit to the boundary box values of sp object

mapTypeId

the initial Map mapTypeId. 'HYBRID' - map type displays a transparent layer of major streets on satellite images. 'ROADMAP' - map type displays a normal street map. 'SATELLITE' - map type displays satellite images. 'TERRAIN' - map type displays maps with physical features such as terrain and vegetation.

disableDoubleClickZoom

enables or disables zoom and center on double click.

draggable

if FALSE, prevents the map from being dragged

keyboardShortcuts

if FALSE, prevents the map from being controlled by the keyboard.

mapTypeControlOptions

the initial display options for the Map type control. 'DEFAULT' - uses the default map type control. 'DROPDOWN_MENU' - a dropdown menu for the screen realestate conscious. 'HORIZONTAL_BAR' - the standard horizontal radio buttons bar.

navigationControl

enabled or disabled state of the navigation control

navigationControlOptions

the initial display options for the navigation control. 'ANDROID' - the small zoom control similar to the one used by the native Maps application on Android. 'DEFAULT' - the default navigation control. The control which DEFAULT maps to will vary according to map size and other factors. It may change in future versions of the API. 'SMALL' - the small, zoom only control. 'ZOOM_PAN' - the larger control, with the zoom slider and pan directional pad.

scaleControlOptions

the initial display options for the scale control.

noClear

if TRUE, do not clear the contents of the Map div.

scrollwheel

if FALSE, disables scrollwheel zooming on the map.

streetViewControl

The initial enabled or disabled state of the Street View pegman control

control

if FALSE, disables control.

InfoWindowControl

see https://developers.google.com/maps/documentation/javascript/reference#InfoWindowOptions

funcSetInfoWindowText

An R callback function that takes the spatial object supplied (SP) and returns a character vector of the same length as the length of SP which contains the text to show in the pop-up InfoWindow. The returned character vector can contain HTML code

funcSetMarkerTitleText

An R callback function that takes the spatial object supplied (SP) and returns a character vector of the same length as the length of SP which contains the text to show as tool-tip text for a marker. The returned character vector must only consist of text

map

name of map object in JavaScript

mapCanvas

name of map DIV element

css

CSS for mapCanvas and cBoxes

api

see https://developers.google.com/maps/documentation/javascript/tutorial

openMap

if TRUE map is opened by default browser

trafficLayerEnabled

If TRUE, display current traffic conditions. If NULL (default), do not add traffic map layer (for backwards compatibility)

trafficLayerName

Layer name to use for traffic layer in map legend. Default is "Traffic". Has no effect if trafficLayerEnabled is NULL

transitLayerEnabled

If TRUE, display transit map layer. If NULL (default), do not add transit map layer (for backwards compatibility)

transitLayerName

Layer name to use for transit layer in map legend. Default is "Transit". Has no effect if transitLayerEnabled is NULL

bicycleLayerEnabled

If TRUE, display bicycle map layer. If NULL (default), do not add bicycle map layer (for backwards compatibility)

bicycleLayerName

Layer name to use for bicycle layer in map legend. Default is "Bicycle". Has no effect if bicycleLayerEnabled is NULL

...

optional arguments

Value

This function returns a list with HTML, JavaScript, Google Maps API key and else what is necessary for the final web map. The second output is html file ready to use.

Author(s)

Milan Kilibarda <kili@grf.bg.ac.rs>, Dan Cheng <dan.cheng@insightanalyticsinc.com>

See Also

bubbleGoogleMaps, ellipseGoogleMaps, heatmapGoogleMaps, plotGoogleMaps, segmentGoogleMaps

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Data preparation
# Point data
data(meuse)
require(maptools)
coordinates(meuse)<-~x+y
proj4string(meuse) <- CRS('+init=epsg:28992')

# Create symbol map of point data based upon the values 
# of cadmium measurements
m<-symbolGoogleMaps(meuse,zcol = "cadmium") 

plotGoogleMaps documentation built on May 2, 2019, 5:45 p.m.