markerData: Generate an XML document for representing Google Maps maker...

Description Usage Arguments Value Author(s) References See Also

Description

This is a simple function that allows us to generate an input file for specifying the locations of GMarker objects to be displayed on a Google Map. Rather than creating the JavaScript code to create the GMarker objects, we create the data that is read at run/display-time and generic JavaScript code process the content and dynamically generates the markers then. This can be useful in AJAX-style setups or when the inputs change or there are many different input files, but the HTML and JavaScript remains constant.

Usage

1
markerData(lat, long, file = character())

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.

file

a character string giving the name of the file to which the XML document should be written. If this is not specified is an empty character vector, the XML document is returned directly and can be post-processed before it is stored, or can be sent to a server in a request without being written to a file.

Value

If file is empty, the result is an object of class XMLInternalDocument which represents the generated XML content. Otherwise, the function creates the specified file and returns its name.

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

googleMapsDoc genericMarkerData.js in system.file("javascript", "genericMakerData.js", package = "R2GoogleMaps").

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


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