latLong: Create JavaScript code for GLatLon objects

Description Usage Arguments Value Author(s) References See Also

Description

This function creates JavaScript code that will create GLatLon objects when the map is viewed in a browser. These represent a geographical position and are used in various places. We use them to create (poly)lines to draw paths and for specifying the location of a marker on a map.

Usage

1
2
3
latLong(lat, long, digits = 4,
        fmt = sprintf("%%.%df", as.integer(digits)),
         prefix = "\t", collapse = ",\n")

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.

digits

the number of digits after the decimal place used to represent the numbers in the JavaScript code

fmt

a character string used to map an individual number to JavaScript form. This is typically not specified in a call but does allow an advanced user to control the way numbers are presented to the JavaScript interpreter.

prefix

a character string used as a prefix before each generated call to new GLatLon. This is used to indent the code appropriately

collapse

a character string or logical value. If this is FALSE, the individual JavaScript calls are returned as a character vector with an element for each call. If this is a string, it is used as the value of the collapse argument in a call to paste.

Value

Depending on whether collapse is a string or FALSE, the result is either a single character string containing the JavaScript code to create all the GLatLon objects, or a character vector with an element for each latitude and longitude pair.

Author(s)

Duncan Temple Lang

References

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

See Also

gpolyline gmarker addOverlay googleMapsDoc

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


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