gpolyline: Create JavaScript code for GPolyline and GMarker objects

Description Usage Arguments Value References See Also

Description

These functions are used to create JavaScript code that will in turn create polyline paths and marker objects that are displayed on a Google Map. These objects are associated with one or more latitude and longitude pairs.

A marker supports many optional settings such as draggable, title, clickable, bouncy, hide.

Usage

1
2
3
4
5
6
gpolyline(lat, long, color = NA, width = NA, var = character(), semiColon = FALSE, addOverlay = !semiColon)
gmarker(lat, long, icon, ..., var = character(), addOverlay = FALSE, call = "new GMarker")
gpolygon(lat, long, border.color = "#FF0000", fill.color = "#FFFFFF", border.width = 1,
          border.alpha = 1, fill.alpha = 0,
          var = character(), semiColon = FALSE, addOverlay =!semiColon,
          close = lat[length(lat)] != lat[1] || long[length(long)] != long[1])

Arguments

lat

this specifies the latitude of the locations. This can be a numeric vector, or alternatively it can be a matrix or list/data.frame where the first two columns are considered to be the latitude and longitude (in that order).

long

a numeric vector giving the longitude of the points. If this is not specified, the longitude is extracted from the lat object.

color

an RGB color specified in hexademical (e.g. \#FF0000 for red) that is used to color the polyline.

width

an integer giving the width of the polyline

var

a character string to which, if specified, the newly created JavaScript GPolyLine or GMarker will be assigned. This has nothing to do with R variables; the assignment takes place in JavaScript.

semiColon

a logical value indicating whether to add a semi-colon to the end of the generated JavaScript command. One may want to suppress this if the result of the call is to be used directly within another call.

addOverlay

a logical value which if TRUE wraps the generated code in a call to addOverlay.

...

name = value pairs This won't work for all possible permissible options, e.g. icon, since that requires a GIcon object rather than a JavaScript primitive value. We might add a facility to allow code to be passed directly.

icon

currently ignored. It is intended to address the issue of specifying the GIcon for the marker.

call

a string that gives the call to create the GMarker object. This parameter allows the caller to specify the name of a JavaScript function that can be used instead of the regular "new GMarker". Unfortunately, one cannot specify additional arguments for those JavaScript calls, so this is less useful than originally intended.

border.color,fill.color

color specifications for the border and interior. These can be specified using hexadecimal format such as "\#FF0000" or the named equivalents "red".

border.width

an integer specifying the number of pixels for the border of the polygon

border.alpha,fill.alpha

these are values between 0 and 1 that specify the opaqueness or alpha-level of the border color and the interior/fill color.

close

a logical value that if TRUE causes gpolygon to ensure that the polygon is closed, i.e. loops back to the original point

Value

Both functions return a character vector/string that contains the generated JavaScript code. gpolyline returns a string. gmarker returns a character vector with as many elements as there are (latitude, longitude) pairs given in the input.

References

http://code.google.com/apis/maps/documentation/reference.html and http://code.google.com/apis/maps/documentation/index.html

See Also

googleMapsDoc latLong

http://www.omegahat.org/R2GoogleMaps/sampleDocs/sfcabs.html


duncantl/R2GoogleMaps documentation built on May 15, 2019, 5:26 p.m.