Skip to Main Content

Interface: mapRegion

QuickNav

mapRegion

The mapRegion interface is used to access the properties and methods of the spatialMap API. You get access to the mapRegion interface with the apex.region function when passed the regionId (static ID) of a Map Region. This region uses the 3rd party Maplibre GL JS library and exposes it via the mapRegion#getMapObject method. Developer code that uses the Maplibre API may not be forward compatible should the Maplibre API change.

Since:
  • 21.2

Extends

Properties

copyrightNotice :string

Copyright notice html expression.

Type:
  • string
Default Value:
  • null
Example

Get option copyrightNotice after initialization.

var value = apex.region( "myRegionId" ).copyrightNotice;

customStyles :Array.<Object>

These styles can be used as the SVG Shape attribute within a Point layer. An array of objects that provide definitions for custom SVG shapes to be used as point markers.

Type:
  • Array.<Object>
Properties:
Name Type Description
type string Svg element type
name string Svg shape name that can be used to specify the SVG shape to display point objects.
width number Svg shape width
height number Svg shape height
viewBox string Defines the position and dimension of an SVG viewport.
elements Array.<Object> Array of objects that represent the necessary svg child elements to create the svg shape. Each object most contain all the necessary element attrs.
Example

Get or set option customStyles after initialization.

// get
var value = apex.region( "myRegionId" ).customStyles;
// set
apex.region( "myRegionId" ).customStyles = [
   {
       "name": "MyCamera",
       "width": 20,
       "height": 20,
       "paint-order": "stroke",
       "viewBox": "0 0 20 20",
       "elements": [
           {
               "type": "path",
               "d": "M15 4h-1.2l-.9-1.2c-.4-.5-1-.8-1.6-.8H8.8c-.7 0-1.3.3-1.6.8L6.2 4H5c-1.1 0-2 .9-2 2v5c0 1.1.9 2 2 2h2.2l2.4 4.7c.1.2.4.3.7.2.1 0 .2-.1.2-.2l2.4-4.7H15c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-5 7c-1.4 0-2.5-1.1-2.5-2.5S8.6 6 10 6s2.5 1.1 2.5 2.5S11.4 11 10 11z"
           }
       ]
    }
];

element :jQuery

The jQuery object for the region element.

Type:
  • jQuery
Inherited From:
Example

Get option element after initialization.

var value = apex.region( "myRegionId" ).element;

itemsToSubmit :string

Comma separated list of page items on the current page to be set into session state when an AJAX request is made.

Type:
  • string
Default Value:
  • null
Example

Get option itemsToSubmit after initialization.

var value = apex.region( "myRegionId" ).itemsToSubmit;

layerMessages :Object

Position of "No Data Found" and "More Data Found" messages container.

Type:
  • Object
Properties:
Name Type Description
position string One of "top" or "bottom".
selector string Selector for the DIV container to display the messages in.
Default Value:
  • null
Example

Get or set option layerMessages after initialization.

// get
var value = apex.region( "myRegionId" ).layerMessages;
// set
apex.region( "myRegionId" ).layerMessages = { position: "top" };

layers :Array.<Object>

An array of objects with basic information about layers. Required.

Type:
  • Array.<Object>
Properties:
Name Type Description
id number Layer id.
label string Layer name.
useSpatialIndex boolean If true the widget will only fetch rows for the current map window from the database. This provides a performance benefit when the data source contains a large amount of rows.
minZoom number Specify the minimum zoom level for the layer to become visible.
maxZoom number Specify the maximum zoom level for this layer to remain visible.
tooltip Object Layers features tooltip information.
Properties
Name Type Description
template string If Advanced formatting has been chosen for the tooltip then user needs to provide an HTML expressions to be shown as tooltip when hovering over an layer feat on the map.
cssClasses string Additional css classes to be added in tooltip container.
infoWindow Object Layers features info window information.
Properties
Name Type Description
template string If Advanced formatting has been chosen for the info window then user needs to provide an HTML expressions to be shown as info window when clicking on an layer feat on the map.
cssClasses string Additional css classes to be added in info window container.
Example

Get option layers after initialization.

var value = apex.region( "myRegionId" ).layers;

lazyLoading :boolean

Whether load map data making an ajax request or not. Required.

Type:
  • boolean
Default Value:
  • false
Example

Get option lazyLoading after initialization.

var value = apex.region( "myRegionId" ).lazyLoading;

legend :Object

Legend area position and styles.

Type:
  • Object
Properties:
Name Type Description
position string One of "start", "end" or "selector"
selector string JQuery selector to display the legend in.
title string Legend title text.
cssClasses string Additional css classes to be added in lagend container.
Default Value:
  • null
Example

Get or set option legend after initialization.

// get
var value = apex.region( "myRegionId" ).legend;
// set
apex.region( "myRegionId" ).legend = { positon: "start", title: "My layers" };

mapData :Object

Object returned by the AJAX request.

Type:
  • Object
Properties:
Name Type Description
map Object Object with map bbox coordinates and series information.
Properties
Name Type Description
bbox Array.<Object> Boundary box. Array of coordinates that describes the map window where all the layers features will be displayed.
series Array.<Object> Array of series that represent the layers. Series will contain all the feature points and information about the layers that will be created by maplibre.
Default Value:
  • null
Example

Get option mapData after initialization.

var value = apex.region( "myRegionId" ).mapData;

mapFeatures :Object

Map tools to be used in the map.

Type:
  • Object
Properties:
Name Type Description
mousewheelZoom boolean If true scroll zoom will be enabled.
scaleBar boolean If true scale control will be enabled.
circleTool boolean If true circle tool will be enabled.
browserLocation boolean If true geolocate control will be enabled.
rectangleZoom boolean If true rectangle zoom tool will be enabled.
distanceTool boolean If true distance tool will be enabled.
overviewMap boolean If true over view map will be displayed on map.
infiniteMap boolean If true maplibre will render multiple world copies.
Example

Get or set option mapFeatures after initialization.

// get
var value = apex.region( "myRegionId" ).mapFeatures;
// set
apex.region( "myRegionId" ).mapFeatures = { 
    mousewheelZoom: true, 
    scaleBar: true, 
    circleTool: true, 
    browserLocation: true, 
    rectangleZoom: true, 
    distanceTool: true, 
    overviewMap: true, 
    infiniteMap: true 
};

mapStatusItem :string

This item will be populated with the current map bbox. So whenever the map is zoomed or dragged, store the current bbox in this item.

Type:
  • string
Default Value:
  • null
Example

Get or set option mapStatusItem after initialization.

// get
var value = apex.region( "myRegionId" ).mapStatusItem;
// set
apex.region( "myRegionId" ).mapStatusItem = "P1_STATUS_ITEM";

mapUnitSystem :string

Unit system that will be used for scale control and distance tool. One of "metric" or "imperial".

Type:
  • string
Default Value:
  • "metric"
Example

Get or set option mapUnitSystem after initialization.

// get
var value = apex.region( "myRegionId" ).mapUnitSystem;
// set
apex.region( "myRegionId" ).mapUnitSystem = "metric";

Navigation Controls Bar Object. Add zoom and rotation (compass) controls to the map. Required.

Type:
  • Object
Properties:
Name Type Description
type string One of "none", "no-compass" or "full".
position string One of "top-left","top-right" or "bottom-left".
Example

Get or set option navigationBar after initialization.

// get
var value = apex.region( "myRegionId" ).navigationBar;
// set
apex.region( "myRegionId" ).navigationBar = { type: "full", position: "top-right" };

resetMapPosition :boolean

If true map position will be initialized using the specified initial map position (basedOnFeatures, getFromBrowser or static values for longitude, latitude and zoom level). If false widget will initialize map position using session state.

Type:
  • boolean
Default Value:
  • false
Example

Get option resetMapPosition after initialization.

var value = apex.region( "myRegionId" ).resetMapPosition;

tileLayer :Object

Tyle layer information object. Required.

Type:
  • Object
Properties:
Name Type Description
type string Tile layer type. Currently map component only supports tile layers from Oracle map server, we might support alternative map providers like Google or OSM as well for next versions.
name string Tile layer name for light mode. One of "osm-bright", "osm-positron", "bi-world-map", "osm-dark-matter" or "world-map".
darkmodeName string Tile layer name for dark mode. One of "osm-bright", "osm-positron", "bi-world-map", "osm-dark-matter" or "world-map".
Example

Get or set option tileLayer after initialization.

// get
var value = apex.region( "myRegionId" ).tileLayer;
// set
apex.region( "myRegionId" ).tileLayer = { name: "osm-bright", darkmodeName: "osm-dark-matter" };

type :string

The mapRegion type is "SpatialMap".

Type:
  • string
Overrides:

useVectorTileLayers :boolean

Determines if raster or vector tile layer is used. If false map will use raster tile layers. If true map will use vector tile layers. Vector tiles are better quality. Available vector tile layers are: OpenStreetMap Positron, OpenStreetMap Dark and OpenStreetMap Bright.

Type:
  • boolean
Default Value:
  • false
Example

Get option useVectorTileLayers after initialization.

var value = apex.region( "myRegionId" ).useVectorTileLayers;

Events

changed

Triggered when the map area or zoom level has changed.

Properties:
Name Type Description
event Event jQuery event object.
data Object
Properties
Name Type Description
changeType string One of "map-drag","map-zoom","toggle-layer","map-rotate","circle-drawn","circle-removed","feature-added","feature-removed","feature-updated"
layers Array.<Object> An array of objects with basic information about the visible layers on map.
bbox Array.<Object> Boundary box. Array of coordinates that describes the current map window.
zoom number Current map zoom level.
pitch number Map current direction user is facing measured clockwise as an angle.
bearing number Map current tilt in degrees.
circle object GeoJSON object with the circle coordinates. Sent only when a circle is drawn.
Example

Bind an event listener to the spatialmapchanged event:

$( ".selector" ).on( "spatialmapchanged", function( event, data ) {
    // do something with data.changeType, data.layers, data.bbox, data.zoom, data.pitch, data.bearing and data.circle
} );

click

Triggered when the map (not a layer feature) has been clicked.

Properties:
Name Type Description
event Event jQuery event object.
data Object
Properties
Name Type Description
lat number Latitude where the map was clicked.
lng number Longitude where the map was clicked.
Example

Bind an event listener to the spatialmapclick event:

$( ".selector" ).on( "spatialmapclick", function( event, data ) {
    // do something with data.lat and data.lng
} );

initialized

Triggered when map is completely initialized (all JS loaded, map is drawn).

Properties:
Name Type Description
event Event jQuery event object.
Example

Bind an event listener to the spatialmapinitialized event:

$( ".selector" ).on( "spatialmapinitialized", function() {
    // do something when map region is initialized
} );

objectclick

Triggered when one of the spatial features has been clicked.

Properties:
Name Type Description
event Event jQuery event object.
data Object
Properties
Name Type Description
id number Id of feature. Sent only if feature layer is not a cluster and primary Key column was specified.
lat number Latitude of feature point. In case layer feature is not a point, latitude will belong to cursor position at the moment of clicking the layer feature.
lng number Longitude of feature point. In case layer feature is not a point, longitude will belong to cursor position at the moment of clicking the layer feature.
tooltip string JSON that contains the tooltip data of the layer feature. Sent only if feature layer is not a cluster.
infoWindow string JSON that contains the info window data of the layer feature. Sent only if feature layer is not a cluster.
cluster_id number Id of cluster feature. Sent only if feature point is a cluster.
point_count number Number of points into the cluster. Sent only if festure point is a cluster.
Example

Bind an event listener to the spatialmapobjectclick event:

$( ".selector" ).on( "spatialmapobjectclick", function( event, data ) {
    // do something with data.id, data.lat, data.lng, data.tooltip, data.infoWindow, data.cluster_id and data.point_count
} );

Methods

addFeature(pLayerId, pFeature)

Add a new feature to series and to layer. If no layer id is given feature won't be added.

Parameters:
Name Type Description
pLayerId number Id of layer.
pFeature Object Feature object to be added.
Example

This example add a new feature to the map.

apex.region( "regionId" ).addFeature( 
  apex.region( "regionId" ).getLayerIdByName( "earthquakes" ), 
  {
    id: "6tgy767836",
    geometry: {
      type: "Point",
      coordinates: [ -108.852, 15.8821667 ]
    },
    infoWindow: {
      title: "Title text",
      body: "Body text"
    },
    tooltip: "Tooltip text"
  } 
);

clearCircle()

Removes (clears) the drawn circle from the map. Does nothing if no circle has been drawn.
Example

This example removes the circle drawn with the circle tool.

apex.region( "regionId" ).clearCircle();

closeAllInfoWindows(pLayerIdopt)

Remove all info window pop-ups from layer. If no layer id is given all info windows will be closed.

Parameters:
Name Type Attributes Description
pLayerId number <optional>
Only required to close info windows from a specific layer.
Examples

This example close all opened info window pop-ups.

apex.region( "regionId" ).closeAllInfoWindows();

This example close all opened info window pop-ups, but only from the specified layer

apex.region( "regionId" ).closeAllInfoWindows( apex.region( "regionId" ).getLayerIdByName( "earthquakes" ) );

closeInfoWindow(pLayerId, pFeatureId)

Remove feature info window pop-up. If layer id or feature id are invalid info window won't be closed.

Parameters:
Name Type Description
pLayerId number Id of layer.
pFeatureId string Feature Id.
Example

This example close the specified info window pop-up.

apex.region( "regionId" ).closeInfoWindow( apex.region( "regionId" ).getLayerIdByName( "earthquakes" ), "6tgy767836" );

closeTooltip()

Remove tooltip pop-up.
Example

This example close the tooltip pop-up.

apex.region( "regionId" ).closeTooltip();

displayPopup(pType, pLayerId, pFeatureId, pFocusAfterOpen, pLngLatopt)

Display feature popup. If map initialization has not been completed or pop-up type, layer id or feature id are invalid pop-up won't be displayed.

Parameters:
Name Type Attributes Description
pType string Pop-up type. One of "tooltip" or "infoWindow".
pLayerId number Id of layer.
pFeatureId string Feature Id.
pFocusAfterOpen boolean Whether popup should get focus or not.
pLngLat Object <optional>
Tooltip coordinates. Only required if feature geometry type is other than "Point".
Properties
Name Type Attributes Description
lng <optional>
Tooltip longitude.
lat <optional>
Tooltip latitude.
Examples

This example display the tooltip pop-up.

apex.region( "regionId" ).displayPopup( "tooltip", apex.region( "regionId" ).getLayerIdByName( "earthquakes" ), "6tgy767836" );

This example display the info window pop-up. This pop-up will not be focused after open.

apex.region( "regionId" ).displayPopup( "infoWindow", apex.region( "regionId" ).getLayerIdByName( "earthquakes" ), "6tgy767836", false );

This example display the info window pop-up on a polygon at the specified position.

apex.region( "regionId" ).displayPopup( "infoWindow", apex.region( "regionId" ).getLayerIdByName( "earthquakes" ), "8jd4760465", false, { lng: 0, lat: 0 } );

focus()

Focus the map

Overrides:
Example

This example focus the map.

apex.region( "regionId" ).focus();

getCircle() → {Object}

Returns the current circle, which has been drawn with the circle tool.
Returns:
The drawn circle coordinates as a GeoJSON polygon, null if no circle has been drawn.
Type
Object
Example

This example gets the current circle drawn with circle tool.

apex.region( "regionId" ).getCircle();

getFeature(pLayerId, pFeatureId) → {Object}

Returns feature object from layer. If no layer id or feature id are given return empty object.

Parameters:
Name Type Description
pLayerId number Id of layer.
pFeatureId string Id of feature.
Returns:
An object containing feature properties.
Type
Object
Example

This example gets the specified feature object.

apex.region( "regionId" ).getFeature( apex.region( "regionId" ).getLayerIdByName( "earthquakes" ), "0i97th6465" );

getLayerIdByName(pName) → {number}

Returns layer id. If no layer name is given return null.

Parameters:
Name Type Description
pName string Layer name.
Returns:
Layer ID.
Type
number
Example

This example gets the id of the specified layer.

apex.region( "regionId" ).getLayerIdByName( "earthquakes" );

getLayers() → {Array.<Object>}

Returns layers objects array.
Returns:
An array of objects containing layers information.
Type
Array.<Object>
Example

This example gets all the layers objects.

apex.region( "regionId" ).getLayers();

getMapBboxAndZoomLevel() → {Object}

Return the current map window bbox and the zoom level in one object. If map initialization has not been completed return an empty object.

Returns:
An object containing the bbox and zoom properties.
Type
Object
Example

This example gets the current map window BBOX and the zoom level in one object.

apex.region( "regionId" ).getMapBboxAndZoomLevel();

getMapCenterAndZoomLevel() → {Object}

Return the current map center and the zoom level in one object. If map initialization has not been completed return an empty object.

Returns:
An object containing the center and zoom properties.
Type
Object
Example

This example gets the current map center and the zoom level in one object.

apex.region( "regionId" ).getMapCenterAndZoomLevel();

getMapObject() → {Object}

Returns the Maplibre GL JS map object. If map initialization has not been completed return null.

Developer code that uses the Maplibre API may not be forward compatible should the Maplibre API change.

Returns:
The maplibre object to call maplibre API functions on.
Type
Object
Example

This example gets the maplibre map object.

apex.region( "regionId" ).getMapObject();

getMapPitchAndBearing() → {Object}

Return the current map pitch and the bearing values in one object. If map initialization has not been completed return an empty object.

Returns:
An object containing the pitch and bearing properties.
Type
Object
Example

This example gets the map pitch and bearing properties in one object.

apex.region( "regionId" ).getMapPitchAndBearing();

getMapStatus() → {Object}

Return the current map bbox, zoom level, pitch and bearing values in one object. If map initialization has not been completed return an empty object.

Returns:
An object containing the bbox, zoom, pitch and bearing properties.
Type
Object
Example

This example gets the current map bbox, zoom level, pitch and bearing values in one object.

apex.region( "regionId" ).getMapStatus();

off(events, …args)

Removes an event handler from the widget element associated with this region. This method only applies to regions that are implemented with a jQuery UI style widget. This means that region#widgetName property must be defined and the region#widget method returns a value.

This is a shortcut for calling apex.region(id).widget().off(...). Unlike the jQuery object off method this does not return the jQuery object and therefore is not chainable. See the jQuery documentation for details.

See also region#on.

Parameters:
Name Type Attributes Description
events One or more space-separated event types and optional namespaces as defined by the jQuery off method. For events defined by this region widget the event name prefix can be omitted.
args * <repeatable>
Other arguments to be passed to the widget's jQuery object off method such as selector, data, and handler.
Inherited From:
Example

This example removes all event handlers for the selectionChange event of an Interactive Grid region. Note that the short event name "selectionChange" can be used rather than the full name "interactivegridselectionchange". See also interactiveGrid#event:selectionchange.

apex.region( interactiveGridRegionId ).off( "selectionChange" );

on(events, …args)

Attaches an event handler to the widget element associated with this region. This method only applies to regions that are implemented with a jQuery UI style widget. This means that region#widgetName property must be defined and the region#widget method returns a value.

This is a shortcut for calling apex.region(id).widget().on(...). Unlike the jQuery object on method this does not return the jQuery object and therefore is not chainable. See the jQuery documentation for details.

See also region#off.

Parameters:
Name Type Attributes Description
events One or more space-separated event types and optional namespaces as defined by the jQuery on method. For events defined by this region widget the event name prefix can be omitted.
args * <repeatable>
Other arguments to be passed to the widget's jQuery object on method such as selector, data, and handler.
Inherited From:
Example

This example handles the selectionChange event of an Interactive Grid region by logging a message to the console. Note that the short event name "selectionChange" can be used rather than the full name "interactivegridselectionchange". See also interactiveGrid#event:selectionchange

apex.region( interactiveGridRegionId ).on( "selectionChange", function(event, data) {
    console.log("Selection changed; # records selected is", data.selectedRecords.length );
} );

refresh()

Update map layers data. If map initialization has not been completed region can't be refreshed.

Overrides:
Example

This example make an ajax request to server to update layers data.

apex.region( "regionId" ).refresh();

removeFeature(pLayerId, pFeatureId)

Removes feature from map. If no layer id or feature id are given feature won't be removed.

Parameters:
Name Type Description
pLayerId number Id of layer.
pFeatureId string Id of feature to remove.
Example

This example removes the specified feature from the map.

apex.region( "regionId" ).removeFeature( apex.region( "regionId" ).getLayerIdByName( "earthquakes" ), "8jd4760465" );

reset()

Resets the map instance.
Example

This example resets the map instance.

apex.region( "regionId" ).reset();

setCenter(pCenter)

Recenters the map to the specified position. If map initialization has not been completed map center can't be set.

Parameters:
Name Type Description
pCenter Array.<Object> Longitude, latitud array.
Example

This example centers the map to Washington, D.C.

var lng = -77.050636,
    lat = 38.889248;
apex.region( "regionId" ).setCenter( [ lng, lat ] );

setZoomLevel(pZoomLevel)

Zooms the map to the specified level. If map initialization has not been completed zoom level can't be set.

Parameters:
Name Type Description
pZoomLevel number The new zoom level.
Example

This example sets the zoom level to 3.

apex.region( "regionId" ).setZoomLevel( 3 );

updateFeature(pLayerId, pFeature)

Update feature from series and layer source. If no layer id or feature object are given feature won't be updated.

Parameters:
Name Type Description
pLayerId number Id of layer.
pFeature Object Feature object to update.
Example

This example update the specified feature from series in the map.

apex.region( "regionId" ).updateFeature( 
  apex.region( "regionId" ).getLayerIdByName( "earthquakes" ), 
  {
    id: "6tgy767836",
    geometry: {
      type: "Point",
      coordinates: [ -128.852, 55.8821667 ]
    },
    infoWindow: {
      title: "My info window title",
      body: "My info window body"
    },
    tooltip: "My tooltip content"
  } 
);