Add a programmable google map.
GMap Molecule | |
Preference Dialog | |
Comments | GMap molecule sends out additional events that a script molecule can listen to. |
Properties | |
type | string, ( r ) |
pref.name | string, ( r ) |
pref.lat | float, ( r, w ) |
pref.lng | float, ( r, w ) |
pref.z | int, ( r, w ) |
pref.type | string, ( r, w ) |
mapType | string, ( r ) |
center | object, ( r ) |
bounds | object, ( r ) |
zoom | int, ( r, w ) |
tilt | float, ( r, w ) |
heading | float, ( r, w ) |
Functions | |
attach | |
detach | |
delete | |
rename | |
refresh | |
clone | |
serialize | |
setCenter | |
getLatLngFromAddress | |
getLatLngFromPixel | |
getPixelFromLatLng | |
addMarker | |
removeMarkerByName | |
removeMarkerByLatLng | |
clearMarkers | |
panTo | |
panBy | |
zoomIn | |
zoomOut | |
plotRoute | |
plotRouteByAddresses | |
removeRoute | |
getDirections | |
openInfoWindow | |
closeInfoWindow | |
viewTraffic |
GMap molecule sends out additional events that a script molecule can listen to. Using these events, implementers can create a highly interactive google map applications. These events are,
mousemove | mouse moves over the map. |
mouseover | mouse enters the map. |
mouseout | mouse leaves the map. |
click | a mouse click on the map. |
dblclick | a mouse double click on the map. |
rightclick | a mouse right click on the map. |
maptypeid_changed | user changed the map type. |
projection_changed | user changed projection type in 3D view. |
tilt_changed | user changed tilt amount in 3D view. |
heading_changed | user changed map heading in 3D view. |
center_changed | user changed map center. |
idle | nothing has happend. |
infowindowopen | an infowindow has just been opened. |
infowindowclose | an infowindow has just been closed. |
zoom_changed | user changed zoom level. |
dragstart | user has started dragging the map. |
drag | user is dragging the map. |
dragend | user has finished dragging the map. |
mapload | map has finished loading all its tiles. |
string, ( r )
The scriptable name for this molecule. This name can be set using rename function dynamically.
getLatLngFromAddress(address, callback);
Use google map’s geocoder to resolve an address to latitude and longitude. This operation is asynchonous, use a callback to receive the result.
address | (string) a valid street address. |
callback | (mixed) a document level function or a script molecule. The result is in the format of {lat:value, lng:value}. |
N/A
getLatLngFromPixel(x, y);
Returns latitude and longitude from the given (x, y) position in a droplet’s window.
x | (int) x-coordinate in relation to the top left corner of the droplet. |
y | (int) y-coordinate in relation to the top left corner of the droplet. |
(object) {lat:value, lng:value}
plotRoute(lat1, lng1, lat2, lng2, opt);
Computes and displays directions between two places given by (lat1, lng1) and (lat2, lng2).
lat1 | (float) source latitude. |
lng1 | (float) source longitude. |
lat2 | (float) destination latitude. |
lng2 | (float) destination longitude. |
opt | (object) routing preferences. Can have the following properties, |
avoidHighways - (bool) avoidTolls - (bool) optimizeWaypoints - (bool) provideRouteAlternatives - (bool) travelMode - (const) GMAP_DRIVING, GMAP_BICYCLING, GMAP_TRANSIT, GMAP_WALKING. transitOptions - (object) waypoints - (object) unitSystem - (const) 'IMPERIAL', 'METRIC'.
See Google Map Direction Service for information on how to set these values.
N/A
plotRouteByAddresses(addr1, addr2, opt);
Computes and displays directions between two places given by addr1 and addr2.
addr1 | (string) source address. |
addr2 | (string) destination address. |
opt | (object) routing preferences. Can have the following properties, |
avoidHighways - (bool) avoidTolls - (bool) optimizeWaypoints - (bool) provideRouteAlternatives - (bool) travelMode - (const) GMAP_DRIVING, GMAP_BICYCLING, GMAP_TRANSIT, GMAP_WALKING. transitOptions - (object) waypoints - (object) unitSystem - (const) 'IMPERIAL', 'METRIC'.
See Google Map Direction Service for information on how to set these values.
N/A
openInfoWindow(name, opt);
Opens a info window at the named marker.
name | (string) a valid marker name. |
opt | (object) info window preferences. Can have the following properties, |
content - (string) Content to display in the InfoWindow. This can be an HTML element, a plain-text string, or a string containing HTML. disableAutoPan - (bool) Disable auto-pan on open. By default, the info window will pan the map so that it is fully visible when it opens. maxWidth - (int) Maximum width of the infowindow, regardless of content's width. pixelOffset - (object) The offset, in pixels, of the tip of the info window from the anchor point. position - (object) The LatLng at which to display this InfoWindow. If the InfoWindow is opened with an anchor, the anchor's position will be used instead. zIndex - (int) All InfoWindows are displayed on the map in order of their zIndex, with higher values displaying in front of InfoWindows with lower values.
See Google Map InfoWindow options for information on how to set these values.
N/A