ggooglemaps {gWidgetsWWW}R Documentation

Contructor for Google maps widget

Description

This creates a widget to show a map provided by Google. One can specify the center of the map, markers on the map and add line semgemnts and polygons. This extension to gWidgets is gWidgetsWWW specific.

Usage

ggooglemaps(x, title = "", type = c("map", "panorama"), 
        key = "ABQIAAAAYpRTbDoR3NFWvhN4JrY1ahS5eHnalTx_x--TpGz1e2ncErJceBS7FrNBqzV5DPxkpbheIzZ9nTJPsQ",
container, ...)

Arguments

x Location of center of map. Given as a string containing an address, or as a vector of latitude and longitude values.
title The center is marked. This sets the text for the tooltip.
type Determines type of map. One of "map" or "panorama".
key NOT WORKING! SEE BELOW. To use a google map, one must register their domain and get a "key" from Google. The default key is for the domain 127.0.0.1:8079, the Rpad local server default. To use a different domain, one must specify a new key here after getting it from http://code.google.com/apis/maps
container A gWidgetsWWW container object
...

Details

This widget was created using the code posted to the ExtJS blog by Shea Frederick http://extjs.com/blog/2008/07/01/integrating-google-maps-api-with-extjs/ .

This widget requires the HTML page that will render it have the DOCTYPE of the page set according to these instructions: http://code.google.com/apis/maps/documentation/index.html#XHTML_and_VML

Next, the website the page will be listed on must register to have an API key: http://code.google.com/apis/maps/signup.html. NOT WORKING:This key is specifies through the key argument. The default will work for the domain 127.0.0.1:8079.

The key can be specified in the header of the html page that will render the gWidgets code. The following will work for the domain 127.0.0.1:8079:

<script src="http://maps.google.com/maps?file=api&v=2.x&key=ABQIAAAAYpRTbDoR3NFWvhN4JrY1ahS5eHnalTx_x--TpGz1e2ncErJceBS7FrNBqzV5DPxkpbheIzZ9nTJPsQ" type="text/javascript"></script>

This widget is experimental. Its API is still not settled. As of now, the method svalue<- is used to set the center of the map. After rendering this is done using a data vector of longitude and latitude. Prior to rendering an address can be used.

The [ method will return the markers locations, but does not reflect their position after if they are moved with the mouse.

The [$<$- method can be used to set markers. The value can These are specified in a 2 or 3 column data frame with columns of latitude, longitude and the optional title. After the widget has rendered, the proto method widget$addMarker is more efficient.

The handlers addHandlerClicked and addHandlerDoubleclick should work. The first argument of the handler, h, is, as usual, a list. The component latlng contains a vector with the latitude and longitude of the location the mouse click occurred at.

More of the Google maps API is availble through some proto methods. These methods are called using the dollar sign notation, as in widget\$methodname(methodargs).

The available proto methods and their signatures are:

Adding additional methods from the Google API is certainly possible.

Value

Returns a gWidgetsWWW object.

Author(s)

John Verzani

References

http://extjs.com/blog/2008/07/01/integrating-google-maps-api-with-extjs/, http://code.google.com/apis/maps/


[Package gWidgetsWWW version 0.0-6 Index]