-
-
Notifications
You must be signed in to change notification settings - Fork 16
Plugin Attributes Reference
Application-level Attributes
- Google API Key [v1.0]
- No Address Results message [v1.0]
- Directions Not Found message [v1.0]
- Directions Zero Results message [v1.0]
- Min. Zoom [v1.0]
- Max. Zoom [v1.0]
- Maximum Records [v1.0]
- Unit System [v1.5]
- Plugin URL Path [v1.5]
Region Attributes
Region Plugin Attributes
- Min. Map Height [v1.0]
- Visualisation [v1.0]
- Zoom Level on Click [v1.0]
- Option: Pan on click [v1.0]
- Option: Draggable pins [v1.0]
- Option: Pan Allowed [v1.0]
- Option: Zoom Allowed [v1.0]
- Option: Drag & Drop GeoJSON [v1.1]
- Option: Disable Auto Fit Bounds [v1.1]
- Option: Show Spinner [v1.2]
- Option: Suppress No Data Found message [v1.5]
- Option: Detailed Mouse Events [v1.5]
- Initial Zoom Level [v1.0]
- Initial Map Center [v1.0]
- Rows Per Batch [v1.2]
- Language [v1.2]
- Region [v1.2]
- Restrict to Country code [v1.0]
- Map Style [v1.0]
- Dissipating (Heatmap) [v1.0]
- Opacity (Heatmap) [v1.0]
- Radius (Heatmap) [v1.0]
- Travel Mode (Directions) [v1.0]
- Optimize Waypoints (Directions) [v1.0]
- Drawing Mode [v1.1]
- Default Map Type [v1.0]
- Gesture Handling [v1.0]
- Escape special characters [v1.0]
- Messages - No Data Found Message [v1.0]
- Advanced - Initialization JavaScript Code [v1.0]
Other Attributes
- directionsPanel [v1.2]
- iconBasePath [v1.2]
- infoLayerFormatFn [v1.5]
- markerFormatFn [v1.2]
- spiderfier options [v1.2]
- showInfoLayer [v1.5]
- showInfoPopups [v1.5]
- showPins [v1.5]
- spiderfyFormatFn [v1.2]
- featureColor [v1.4]
- featureColorSelected [v1.4]
- featureSelectable [v1.4]
- featureHoverable [v1.4]
- featureStyleFn [v1.4]
Appendix
Set these in Shared Components / Component Settings. These attributes are applied to all instances of the plugin in the application.
Required. If you don't set this, you will get an error popup and a "NoApiKeys" error in the console log. Refer: https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key
Optional. Set this to override the default message to display if an address search returns no results.
Optional. Set this to override the default message to display if directions are requested for locations not found.
Optional. Set this to override the default message to display if directions is unable to find a route between any of the origin, destination or intervening waypoints.
Minimum Zoom Level - must be 0 to 23. Set to 0 to allow zooming out to entire world map.
Maximum Zoom Level - 0 to 23. Set to blank to allow zooming in to show maximum detail.
Required. Maximum number of records to fetch from the SQL Query. Note that datasets that are very large (e.g. 10,000+) may perform poorly on the client's machine. The Heatmap option is leaner and can support larger datasets.
Added in Release 1.5. Required. "Metric" (default) or "Imperial". Unit system to use for the Directions service. This affects how Directions are shown (e.g. kilometres vs. miles) and how the Directions event reports the total Distance (meters vs. miles).
Added in Release 1.5. Optional. Normally, this may be left blank (i.e. auto-detect). Set this to override the automatic detection of the window origin+path for downloading plugin image icons. Don't include a trailing slash (/). The plugin will append the plugin path prefix and the file name at run time.
Set these on the plugin Region.
-
Source - (none)
If you just want a map without any data.
-
Source - Location
Set to Local Database (e.g. to use a SQL Query).
-
Source - Type
If Local Database, set Type to Table / View, SQL Query or PL/SQL Function Body returning SQL Query.
The columns expected by the selected Visualisation must be named correctly. Refer to SQL Query examples for more details.
The column order and data types must be exactly as the plugin expects. Refer to SQL Query examples for more details.
Set to any page items if the SQL Query is dependent on any.
If left blank, the internal region ID will be used to generate the plugin. It is recommended to set this to a predictable value if you wish to interact with the plugin using custom JavaScript.
Message to show if the query returns no rows. If blank, APEX supplies a default message. To suppress the message, set the plugin option "Suppress No Data Found message".
Set these on the plugin region Attributes.
Desired height (in pixels) of the map region. Note: the width will adjust according to the available area of the containing window.
Required. This controls how the data is presented on the map. Set to one of the following options:
-
Pins (default)
Show a pin for every data point. The pin may optionally use an alternative icon, or show a single-character label. Each pin can also have an information window showing text (most HTML allowed) when the user selects the pin.
-
Info Layer
Added in Release 1.5. Show the Info (as HTML rendered within a div) directly on the map instead of pins. The size of the div will depend on the content you provide. The content may include text, HTML formatting, icons, and images.
-
Marker Clustering
Show a pin for every data point. Cluster pins where many pins are very close together.
-
Spiderfier [v1.2]
Show a pin for every data point. If the user clicks on a group of pins that are close to each other or overlapping, the spiderfier shifts the pins out in a spiral with lines pointing to where they were.
-
Heatmap
Show the data as a heat map. Suitable for larger volume of data points. Note: a different query structure is required (i.e. no pin labels or icons are used).
-
Directions
Show a route using the data points from the query. Directions can be shown for Driving, Walking, Bicycling or Public Transport. A pin will also be shown at each point.
PRE-REQUISITE: to use Directions you must enable the Directions API on your Google Cloud Platform project. Read "Getting started" at https://developers.google.com/maps/documentation/javascript/directions to enable the Directions API.
Zoom the map to this level (0..23) when the user clicks on a map marker, adds a new marker, or the geolocate action finds the device location. Set to blank to not zoom on any of these events.
See also: Pan on click below.
On by default. If set, when the user clicks on a pin the map will pan so the pin will be visible. Set off to stop this behaviour. NOTE: if you switch this off, you will almost certainly want to clear out Zoom Level on Click - otherwise when the user clicks a pin the map will zoom but not pan.
Allow user to move the pins around on the map. When a pin is moved, the markerDrag event is triggered (refer to Plugin Events Reference).
NOTE: The Draggable pins option does not work with the Directions visualisation.
On by default. Set this to allow the user to pan (move) the map view to different points interactively. To fix the map to the starting location, switch this attribute off.
On by default. Set this to allow the user to zoom the map interactively. To fix the map to the initial zoom level, switch this attribute off.
Allow user to drag and drop a GeoJSON file onto the map. The features in the GeoJSON will be rendered into a data layer on the map.
If you also enable Drawing Mode, the user will also be able to edit these features, and add and remove features.
You can get the resulting set of features as a new GeoJSON document using code like this:
var map = $("#map_mymap").reportmap("instance").map;
map.data.toGeoJson(function(o){
$s("P1_GEOJSON", JSON.stringify(o));
});
By default, whenever the map data is refreshed, the map will be automatically panned/zoomed to fit the bounds of all the pins. Set this option to stop the map from automatically fitting the bounds.
Show APEX "waiting" spinner while data is loading or refreshing.
Added in Release 1.5. If set, when the query returns no rows, no message will be shown. The default behaviour is to show a "No Data Found" popup message.
Added in Release 1.5. Add a listener for detailed mouse events (contextmenu, drag, dragend, dragstart, mouse over, mouse move, mouse out, double click). Required if you need a dynamic action to respond to any of these events. Note: a listener for the click event is always added.
Initial zoom level (0..23) if no data is loaded. Default is 2. If data is loaded, this attribute has no effect.
Set the latitude and longitude as a pair of numbers, delimited by commas, to be used to position the map on page load, if no pin coordinates have been provided by the page item. Default is 0,0. If data is loaded, this attribute has no effect. Note: number values must be expressed using dot (.) as the decimal separator.
Load the pins in multiple ajax calls, with this number of rows per batch. Setting this attribute increases the overall time required to load all the data, but allows the map to start showing some pins earlier, making it more user-friendly.
As each batch is received, the map will expand the bounds (pan & zoom) to show the new pins.
Leave blank to cause all the pin data to be loaded in a single ajax call. The map will wait until the entire data set is downloaded before rendering the pins. This is the fastest way, although for large data sets the user might get impatient.
This attribute is not applicable for the Heatmap visualisation, which needs to load all the data before it can be rendered visually.
By default, the map uses the user's preferred language setting as specified in the browser, when displaying textual information such as the names for controls, copyright notices, driving directions and labels on maps. In most cases, it's preferable to respect the browser setting and leave this attribute blank.
To override the user's preferred language, set the language code; e.g. ja for Japanese. The list of supported languages may be found here.
Substitution syntax allowed, e.g. &P1_LANGUAGE. Note that the page must be reloaded if the language is changed.
When you load the map it applies a default bias for application behavior towards the United States. If you want to serve different map tiles or bias the application (such as biasing geocoding results towards the region), you can override this default behavior by setting the Region attribute.
The region parameter accepts Unicode region subtag identifiers which (generally) have a one-to-one mapping to country code Top-Level Domains (ccTLDs). Most Unicode region identifiers are identical to ISO 3166-1 codes, with some notable exceptions. For example, Great Britain's ccTLD is "uk" (corresponding to the domain .co.uk) while its region identifier is GB. Try this demo to experiment with the changes on the map when you update the region parameter.
As the developer of an application using Google Maps it is your responsibility to ensure that your application complies with local laws by ensuring that the correct region localization is applied for the country in which the application is hosted.
Used when performing an address search. Leave blank to allow geocoding to find any place on earth (see example below). Set to country code (see https://developers.google.com/public-data/docs/canonical/countries_csv for valid values) to restrict geocoder to that country. You can load a table of country codes in your application by running the countries_data.sql script.
Change the default map style. You can generate your own map styles with this tool or copy one from a site like https://snazzymaps.com/.
Only applicable if Visualisation is Heatmap. Specifies whether heatmaps dissipate on zoom. Yes means the radius of influence of a data point is specified by the radius option only. When dissipating is disabled, the radius option is interpreted as a radius at zoom level 0. Default is No.
Only applicable if Visualisation is Heatmap. The opacity of the heatmap, expressed as a number between 0 and 1. Default is 0.6.
Only applicable if Visualisation is Heatmap. The radius of influence for each data point, in pixels. Default is 5 pixels.
Only applicable if Visualisation is set to "Directions". Select the mode of transport when showing directions. Possible values include Driving (default), Walking, Bicycling, and Transit (public transport).
Only applicable if Visualisation is Directions. If set to Yes, the intermediate waypoints may be reordered to reduce cost. Default is No (waypoint order is retained).
Setting any of these Drawing Modes enables the Google Maps Drawing Library. A button will be added to the top of the map for each shape, allowing the user to select a shape to draw.
The shapes the user has drawn can then be retrieved from the plugin as a GeoJSON document, which can later be re-loaded onto the map.
Available options include:
- marker
- polygon
- polyline
- rectangle
- circle
When drawn, a circle is merely rendered as a point (at the circle's center) with a hidden "radius" property. I realise this is not terribly user-friendly but is included for completeness. Note that circles are not supported by the GeoJSON data format anyway.
Any shapes drawn, loaded or retrieved using the drawing library are independent of the pins that might also be shown in the map derived from the report query. In particular, retrieving the shapes as a GeoJSON document does not include points for the pins that may have been loaded by the region query, as these pins are not rendered using the drawing library.
Initial map type shown on page load. The user may change the map type.
- Roadmap (default)
- Satellite
- Hybrid
- Terrain
This attribute allows you to select how the map responds to touch gestures on a mobile device. Mobile web users often get frustrated when trying to scroll the page, but an embedded map captures their swipe and pans the map instead. This can even lead to users getting stuck on the map and having to reload the page in order to get back to the rest of the page. This option allows you to make scrolling more intuitive and less frustrating map interaction experience on mobile browsers. This may be set to one of the following values:
- "cooperative": Two-finger touch gestures pan and zoom the map, as do all mouse gestures. One-finger touch gestures are ignored by the map. In this mode, the map cooperates with the page, so that one-finger touch gestures can pan the page.
- "greedy": All touch gestures pan or zoom the map.
- "none": The map cannot be panned or zoomed by user gestures.
- "auto" (default): Gesture handling is automatically set to either cooperative or greedy, depending on whether the page is scrollable or not (defined by a comparison of the page body dimensions and the window dimensions).
If the page is scrollable, "auto" sets the gesture handling mode to cooperative. If the page is not scrollable, "auto" sets the gesture handling to greedy. If the map is in an iFrame, "auto" sets the gesture handling to cooperative because the API can't determine whether the page is scrollable.
This is relevant only to the "flex fields", if supplied in the SQL Query. By default any special characters (such as < and >) will be escaped prior to sending to the client, in order to protect against XSS attacks and to allow the original data to be rendered exactly as entered. To disable this escaping, set this attribute to No.
Set this to customise the message shown in a popup InfoWindow if the SQL Query returns no rows.
Set this to run additional javascript code when the Google Map object has been instantiated. Use this.map to refer to the google.maps.Map object. For example, to hide most of the default UI elements that Google Maps renders on the map:
this.map.setOptions({
"disableDefaultUI": true
});
You can overwrite some plugin attributes (including a lot of the options that may have been set declaratively) here as well, such as this.options.maximumRows, this.options.rowsPerBatch, this.clickZoomLevel, etc. - but not all options can be changed this way, if their effect on the plugin has already been set. Feel free to experiment and see.
Refer also to Other Attributes below for options that can be set using JavaScript.
NOTE: since this code is run before the map data is loaded, some things you might do here will have no effect, e.g. if you set the map position or zoom level, when the map data is loaded the map will most likely be moved and zoomed accordingly.
To have some code run after the data is loaded, create a Dynamic Action on the mapLoaded event.
These attributes are not set declaratively on the plugin. They can be set by adding code to the JavaScript Initialization Code.
Set this to nominate a <div> on your page in which to display human-readable turn-by-turn directions when a Route Map is shown in the map. For example:
this.options.directionsPanel = "directionspanel";
For the above example to work, you would add a region to your page, with the following contents:
<div id="directionspanel"></div>
Set this to a string which will be prepended to the icon column from your query. This is useful if all your icons are at the same location; setting this can significantly reduce the volume of data downloaded to the client, since you don't need to include the full path with each row of data.
this.options.iconBasePath = 'https://maps.google.com/mapfiles/kml/shapes/';
If all your icons are loaded in your Application Static Files, you can set it like this:
this.options.iconBasePath = '#APP_IMAGES#';
Set this to a JavaScript function that will be called for each Info Layer. This is only applicable if Visualisation is InfoLayer (or the showInfoLayer option is true). For example:
this.options.infoLayerFormatFn =
function(layer, marker) {
//layer points to a MapOverlay object
layer.options.verticalAlign = "bottom";
layer.options.horizontalOffset = -10; //pixels
layer.options.minZoom = 2; // hide the info layer if zoomed out past this level
//marker points to the marker info object
if (marker.data.name == "HOME") {
layer.options.div.classList.add("homestyle");
}
};
The MapOverlay object provides the following interface:
-
layer.pos= get or set the marker position for the info layer; the content will not be scaled -
layer.bounds= get or set the bounds for the info layer; the content will be scaled to match this range of lat,lng coordinates (e.g. to show a map image on top of the map) -
layer.content= get or set the content of the info layer div -
layer.div= returns a reference to the info layer div container -
layer.options= get or set the options for the layer:{ horizontalAlign : "left" / "center" / "right" (pos only) verticalAlign : "top" / "middle" / "bottom" (pos only) horizontalOffset : pixel offset (x) (pos only) verticalOffset : pixel offset (y) (pos only) minZoom : (0..23) hide if zoomed out past this level maxZoom : (0..23) hide if zoomed in past this level onClickHandler : function to call if overlay clicked (set to null to stop the info layer responding to clicks) } -
layer.hide()= hide the info layer -
layer.show()= show the info layer -
layer.toggle()= hide or show the info layer
Set this to a JavaScript function that will be called for each marker. It may be used to customise the format of the marker using whatever logic you may require. For example:
this.options.markerFormatFn =
function(marker) {
// if id is even, change the icon to a circle; odd are squares
var iconUrl = 'https://mt.googleapis.com/vt/icon/name=icons/spotlight/'
+ ((marker.data.id % 2 == 0)
? 'spotlight-waypoint-blue.png&scale=1.5'
: 'spotlight-waypoint-a.png&scale=1.5');
marker.icon = {
url: iconUrl,
anchor: new google.maps.Point(14,16)
};
// you can change other attributes of the marker as well
marker.title = marker.title.toUpperCase();
// we can call google.maps.Marker object methods as well
marker.setOpacity(0.5);
if (marker.title == 'HOME') {
// we can shift the marker position
marker.setPosition( {lat: -31.82531, lng: 115.84366} );
}
};
If your logic needs to access the data from your query's "flex" fields, these may be accessed in the marker's data:
this.options.markerFormatFn =
function(marker) {
if (marker.data.attr01 == 'hospital') {
marker.icon = 'https://maps.google.com/mapfiles/ms/icons/hospitals.png';
}
};
You can refer to the flex fields using marker.data.attr01, marker.data.attr02, ... marker.data.attr10. They will all be strings so if you need to do math on them you would convert them to numbers first (e.g. using parseInt or parseFloat).
If true, the info column is rendered directly in a div on the map at the location of the pin. This option is set to true if the Visualisation is set to InfoLayer.
this.options.showInfoLayer = true;
If true, when the user clicks on a pin, an Info Window will popup with the content of the info column rendered within it. This option is set to true if the Visualisation is any of the pin-type visualisation, false if the Visualisation is set to InfoLayer.
this.options.showInfoPopups = true;
If true, a pin is rendered at the location of each data point. This option is set to true if the Visualisation is any of the pin-type visualisation, false if the Visualisation is set to InfoLayer.
this.options.showPins = true;
You can override the default options for the Spiderfier visualisation by setting this.options.spiderfier. For example:
this.options.spiderfier.keepSpiderfied = false;
this.options.spiderfier.basicFormatEvents = false;
Documentation of the Spiderfier options may be found here.
Set this to a JavaScript function to be used to change the format of markers when they are spiderfied or unspiderfied by the Spiderfier visualisation. For example:
this.options.spiderfyFormatFn =
function(marker, status) {
var iconURL = (status == OverlappingMarkerSpiderfier.markerStatus.SPIDERFIED) ?
'spotlight-waypoint-blue.png' :
'spotlight-poi.png';
marker.setIcon({url: 'https://mt.googleapis.com/vt/icon/name=icons/spotlight/' + iconURL});
};
Note: if options.spiderfier.basicFormatEvents = true, status will be
SPIDERFIEDorUNSPIDERFIED; if options.spiderfier.basicFormatEvents = false, status will beSPIDERFIED,SPIDERFIABLE, orUNSPIDERFIABLE.
Color to use for features that are not selected.
this.options.featureColor = '#cc66ff';
Color to use for features that are selected.
this.options.featureColorSelected = '#ff6600';
Set this to false to stop geoJson features responding to the click event by the user. Default is true (when the user clicks a feature, it will be marked and styled as "selected" and the selectFeature / unselectFeature events will fire).
this.options.spiderfier.featureSelectable = false;
Set this to false to stop geoJson features responding to the hover event by the user. Default is true (when the mouse hovers over a feature, it will be styled differently and the mouseoverFeature / mouseoutFeature events will fire).
this.options.spiderfier.featureHoverable = false;
By default, features will be styled using the featureColor / featureColorSelected options. You can override the styling of the features by providing a JavaScript function that, given a feature object, returns a google.maps.Data.StyleOptions object.
this.options.featureStyleFn =
function(feature) {
var color;
if (feature.getProperty('isSelected')) {
color = "#de90c5";
} else if (feature.getProperty('attr01')=="xyzzy") {
color = "#eb4909";
} else {
color = "#d12a9c";
}
return /** @type {!google.maps.Data.StyleOptions} */({
fillColor : color,
strokeColor : color,
strokeWeight : 2
});
};
These attributes were previously available in the beta releases of the plugin. Their behaviour has been changed or removed in v1.0. If you are upgrading from any beta release to v1.0 or later, if you used any of these attributes you will need to make some changes.
-
Set Item Name to ID on Click
REMOVED IN v1.0 - instead, use a dynamic action on the markerClick event - refer to Plugin Events Reference
-
Synchronize with Item
REMOVED in v1.0 - instead, use a dynamic action on change of the item that calls gotoPosByString - refer to Plugin API Reference
-
Marker Icon
REMOVED in v1.0 - instead, specify an icon in the query for each pin
-
Circle Radius Item
REMOVED in v1.0 - instead, set options.markerFormatFn to a javascript function that styles the marker
-
Pan on click
MOVED in v1.0 to Options (see above)
-
Geocode Item
REMOVED in v1.0 - instead, use a dynamic action on change of the item which calls gotoAddress - refer to Plugin API Reference
-
Address Item
REMOVED IN v1.0 - use dynamic action instead which calls getAddress - refer to Plugin API Reference
-
Geolocate
REMOVED IN v1.0 - use dynamic action instead which calls geocode - refer to Plugin API Reference
-
Geolocate Zoom
REMOVED in v1.0 - use dynamic action instead
-
Directions Origin Item
REMOVED IN v1.0 - use showDirections API instead
-
Directions Destination Item
REMOVED IN v1.0 - use showDirections API instead
-
Show Calculated Distance
REMOVED IN v1.0 - use dynamic action on directions event instead
-
Show Calculated Duration
REMOVED IN v1.0 - use dynamic action on directions event instead
-
Attribute1
REMOVED IN v1.0 - use label column in SQL query instead
-
Zoom enabled (condition)
MOVED in v1.0 to Options (see above)
-
Pan enabled (condition)
MOVED in v1.0 to Options (see above)
-
Number of Rows
REMOVED in v1.0 - use Maximum Rows (Component) attribute instead