Constructor
new Map(options)
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
luxx.MapOptions | Map options. Properties
|
- Source:
Example
// To render a map, the API needs to know the element where to display the map (target),
// the predefined background layer (bgLayer) to display,
// the predefined layers (layers),
// the starting zoom level (zoom),
// the central position of the map (position)
var map = new lux.Map({
target: 'map1',
bgLayer: 'basemap_2015_global',
zoom: 18,
position: [75977, 75099]
});
Extends
Methods
addBgSelector(target, bglayers)
It adds a simple background selector control into a specific html element.
Parameters:
| Name | Type | Description |
|---|---|---|
target |
Element | string | Dom element or id of the element to render bgSelector in. |
bglayers |
Array.<(string|number)> | undefined | Array of overlay layer identifiers. 'blank' acts as blank layer. |
- Source:
- See:
addGeoJSON(url, opt_optionsopt)
It displays a GeoJSON file on the map.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
url |
string | Url to the GeoJSON file. |
|||||||||||||||||||||||||
opt_options |
luxx.VectorOptions |
<optional> |
Options. Properties
|
- Source:
addGPX(url, opt_optionsopt)
It displays a GPX file on the map.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
url |
string | Url to the GPX file. |
|||||||||||||||||||||||||
opt_options |
luxx.VectorOptions |
<optional> |
Options. Properties
|
- Source:
- See:
addKML(url, opt_optionsopt)
It displays a KML file on the map.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
url |
string | Url to the KML file. |
|||||||||||||||||||||||||
opt_options |
luxx.VectorOptions |
<optional> |
Options. Properties
|
- Source:
- See:
addLayer(layer)
Adds the given layer to the top of this map. If you want to add a layer
elsewhere in the stack, use getLayers() and the methods available on
ol.Collection.
Parameters:
| Name | Type | Description |
|---|---|---|
layer |
ol.layer.Base | Layer. |
- Source:
- See:
addLayerById(layer, opt_opacityopt, opt_visibilityopt)
Adds the given layer to the top of this map. If you want to add a layer
elsewhere in the stack, use getLayers() and the methods available on
ol.Collection.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
layer |
string | number | The layer id. |
|
opt_opacity |
number |
<optional> |
The layer opacity. Default is 1. |
opt_visibility |
boolean |
<optional> |
The layer visibility. Default is true. |
- Source:
- See:
addMyMapLayer(options) → {Promise}
It loads a MyMaps layer.
Parameters:
| Name | Type | Description | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
luxx.MyMapOptions | The options. Properties
|
- Source:
- See:
Returns:
Promise of the mymaps object.
- Type
- Promise
Example
var map8 = new lux.Map({
target: 'map8',
bgLayer: 'topo_bw_jpeg',
zoom: 12,
position: [76825, 75133]
});
map8.addMyMapLayer({
mapId: '0416ef680fbe4cdaa2d8009262d1127c'
});
addSearch(target, dataSetsopt, onSelectopt)
It adds the search control into an html element.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
target |
Element | string | Dom element or id of the element to render search widget in. |
||
dataSets |
Array.<string> |
<optional> |
['Adresse' | Array of layer used as search sources. |
onSelect |
function |
<optional> |
Optional function called when result is selected. |
- Source:
- See:
getMapReadyPromise() → {Promise}
Get the promise to have a map in a ready state.
- Source:
Returns:
Promise of a configured map.
- Type
- Promise
getShowLayer() → {ol.layer.Vector}
Get the layer containing highlighted features.
- Source:
Returns:
The show layer.
- Type
- ol.layer.Vector
print(nameopt, layoutopt, scaleopt, firstPagesUrlsopt, callbackopt)
Prints the current map.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
name |
string |
<optional> |
The title of the map. |
layout |
string |
<optional> |
The layout of the map. Default is A4 landscape or A4 portrait depending on the map size. Available values are : A4 landscape, A4 portrait, A3 landscape, A3 portrait, A2 landscape, A2 portrait, A1 landscape, A1 portrait, A0 landscape, A0 portrait |
scale |
number |
<optional> |
The scale to use. |
firstPagesUrls |
Array.<Object> |
<optional> |
An array containing urls and type of pages that will be introduced at the beginning of the pdf. Only html and pdf are supported. [{'url': 'http://url1', 'html'},{'url': 'http://url2' 'pdf'}] |
callback |
function |
<optional> |
Optional callback function. |
- Source:
Example
map.print();
setCenter(coordinate, zoom)
Set the center of the current view in EPSG:2169.
Parameters:
| Name | Type | Description |
|---|---|---|
coordinate |
ol.Coordinate | The coordinate of the center. |
zoom |
number | undefined | The zoom numer. |
- Source:
setLanguage(lang)
Parameters:
| Name | Type | Description |
|---|---|---|
lang |
string | Set the language. |
- Source:
setPopupTarget(optPopupTarget, optPopupClass)
Sets the popup target or undefined to let the api create popup.
Parameters:
| Name | Type | Description |
|---|---|---|
optPopupTarget |
Element | string | undefined | The container for map
popups, either the element itself or the |
optPopupClass |
string | undefined | The css class of the row. |
- Source:
setQueryableLayers(queryableLayers)
Set the queryable layers. If undefined then use the default value from metadata.
Parameters:
| Name | Type | Description |
|---|---|---|
queryableLayers |
Array.<(string|number)> | undefined | An array of queryable layers |
- Source:
setShowlayerStyle(style)
Parameters:
| Name | Type | Description |
|---|---|---|
style |
ol.style.Style | Array.<ol.style.Style> | ol.StyleFunction | null | undefined | The style of the show layer. |
- Source:
showFeatures(layer, ids, opt_clicknullable, opt_target, isShowMarker, maxZoom)
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
layer |
string | number | The layer identifier |
|
ids |
Array.<(string|number)> | Array of features identifiers |
|
opt_click |
boolean |
<nullable> |
True if click is needed to show popup |
opt_target |
Element | string | undefined | Element to render popup content in |
|
isShowMarker |
boolean | undefined | True if a marker has to be displayed. |
|
maxZoom |
number | undefined | The maximum zoom to fit. |
- Source:
showLayerInfoPopup(show)
Show a marker on the map at the given location.
Parameters:
| Name | Type | Description |
|---|---|---|
show |
boolean | Set to true will allow to display the feature information popup when clicking on an object. |
- Source:
showMarker(opt_optionsopt) → {ol.Overlay}
Show a marker on the map at the given location.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opt_options |
luxx.MarkerOptions |
<optional> |
Config options Properties
|
- Source:
Returns:
The overlay containing the marker or null if the marker target is not conform.
- Type
- ol.Overlay
showPopup(position, title, content) → {ol.Overlay}
It shows a popup.
Parameters:
| Name | Type | Description |
|---|---|---|
position |
ol.Coordinate | The position of the popup. |
title |
string | The popup title. |
content |
string | The popup content. |
- Source:
Returns:
The popup overlay.
- Type
- ol.Overlay