Using JavaScript Code With Maps

In this section:



x
Function: toggleLayer('mapId', 'layerName')

How to:

The toggleLayer(‘mapId’, ‘layerName’) function toggles the visibility of the specified layer.



x
Syntax: How to Toggle Layer Visibility
function button1_onclick(ctrl) {
toggleLayer('mapId', 'layerName');
}

where:

mapId

Alphanumeric

Is the unique identifier of the map control. For example, mapcontrol1.

layerName

Alphanumeric

Is the unique identifier of a layer within the map. For example, Layer1.


Top of page

x
Function: toggleMarker('mapId', 'layerName', 'markerName')

How to:

The toggleMarker(‘mapId’, ‘layerName’, ‘markerName’) function toggles the visibility of the specified marker.



x
Syntax: How to Toggle Marker Visibility
function button2_onclick(ctrl) {
toggleMarker('mapId', 'layerName', 'markerName');
}

where:

mapId

Alphanumeric

Is the unique identifier of the map control. For example, mapcontrol1.

layerName

Alphanumeric

Is the unique identifier of a layer within the map. For example, Layer1.

markerName

Alphanumeric

Is the unique identifier of a marker within the map. For example, redpin.


Top of page

x
Function: refreshLayer('mapId', 'layerName')

How to:

The refreshLayer(‘mapId’, ‘layerName’) function refreshes the specified layer.



x
Syntax: How to Refresh a Layer
function button3_onclick(ctrl) {
refreshLayer('mapId', 'layerName');
}

where:

mapId

Alphanumeric

Is the unique identifier of the map control. For example, mapcontrol1.

layerName

Alphanumeric

Is the unique identifier of a layer within the map. For example, Layer1.


Top of page

x
Function: panToAddress('address', 'mapId', 'zoom')

How to:

The panToAddress(‘address’, ‘mapId’, ‘zoom’) function pans to a designated address.



x
Syntax: How to Pan to an Address
function button4_onclick(ctrl) {
panToAddress('address', 'mapId', 'zoom');
}

where:

address

Alphanumeric

Is the address you want to pan to. For example, 2 Penn Plaza New York NY 10121.

mapId

Alphanumeric

Is the unique identifier of the map control. For example, mapcontrol1.

zoom

Integer

Is how much you wish to zoom. For example, 7.


Top of page

x
Function: panToPoint('lat', 'long', 'mapId', 'zoom')

How to:

The panToPoint(‘lat’, ‘long’, ‘mapId’, ‘zoom’) function pans to a designated point based on latitude and longitude coordinates the user enters.



x
Syntax: How to Pan To a Point
function button5_onclick(ctrl) {
panToPoint('lat', 'long', 'mapId', 'zoom');
}

where:

lat

Integer

Is the latitude coordinate of the point you want to pan to. For example, 40.7663277.

long

Integer

Is the longitude coordinate of the point you want to pan to. For example, -73.9920777.

mapId

Alphanumeric

Is the unique identifier of the map control. For example, mapcontrol1.

zoom

Integer

Is how much you wish to zoom . For example, 7.


Top of page

x
Function: showAllMarkers('mapId')

How to:

The showAllMarkers(‘mapId’) function displays all map markers, even if it was previously hidden.



x
Syntax: How to Show All Map Markers
function button6_onclick(ctrl) {
showAllMarkers('mapId');
}

where:

mapId

Alphanumeric

Is the unique identifier of the map control. For example, mapcontrol1.


Top of page

x
Function: drawBullseye('mapId', 'lat', 'long', 'selectmarkers', 'units', 'rings', '(list-of-sizes)', '(list-of-colors)')

How to:

The drawBullseye('mapId', 'lat', 'long', 'selectmarkers', 'units', 'rings', '(list-of-sizes)', '(list-of-colors)') function draws a bullseye at a point on the map. This function has optional parameters to select whether to display markers, the units of measure used for the bullseye, the number of rings, the size of the rings, and the color of the rings.



x
Syntax: How to Draw a Bullseye
function button5_onclick(ctrl) {
drawBullseye('mapId', 'lat', 'long', 'selectmarkers', 'units', 'rings', '(list-of-sizes)', '(list-of-colors)');
}

where:

mapId

Alphanumeric

Is the unique identifier of the map control. For example, mapcontrol1.

lat

Integer

Is the latitude coordinate of the point you want to pan to. For example, 40.7663277.

long

Integer

Is the longitude coordinate of the point you want to pan to. For example, -73.9920777.

selectmarkers

Boolean

Is an operator that, when set to true, selects all markers within the Bullseye.

units

Alphanumeric

The unit of measure for the Bullseye rings For example, mi for miles.

rings

Integer

The number of rings the bullseye uses. For example, 3.

list-of-sizes

Integer

A comma separated list of sizes for the bullseye rings. For example, 1, 3, 5.

list-of-colors

Alphanumeric

A comma separated list of colors for the bullseye rings. The colors can be RGB values or hexidecimal values. For example, Blue or #FFFF.


WebFOCUS