Optional
collapsed?: booleanSpecify if LayerImport control should be collapsed at startup. Default is true.
Optional
draggable?: booleanSpecify if widget is draggable
Optional
id?: numberAbility to add an identifier on the widget (advanced option)
Optional
layerTypes?: any[]data types that could be imported : "KML", "GPX", "GeoJSON", "WMS", "WMTS" and "MAPBOX". Values will be displayed in the same order in widget list.
Optional
vectorStyleOptions?: {Options for imported vector layer styling (KML, GPX, GeoJSON)
Optional
GeoJSON?: { defaultStyle?: any }Options for GeoJSON layer styling
Optional
defaultStyle?: anydefault style to be applied to GeoJSON imports in case no style is defined. defaultStyle is an ol.style.Style object.
Optional
GPX?: { defaultStyle?: any }Options for GPX layer styling
Optional
defaultStyle?: anydefault style to be applied to GPX imports in case no style is defined. defaultStyle is an ol.style.Style object.
Optional
KML?: { defaultStyle?: any; extractStyles?: boolean; showPointNames?: boolean }Options for KML layer styling
Optional
defaultStyle?: anydefault style to be applied to KML imports in case no style is defined. defaultStyle is an ol.style.Style object.
Optional
extractStyles?: booleanExtract styles from the KML. Default is true.
Optional
showPointNames?: booleanShow names as labels for KML placemarks which contain points. Default is true.
Optional
MapBox?: { defaultStyle?: any; display?: boolean; editor?: any }Options for MapBox layer styling
Optional
defaultStyle?: anydefault style to be applied to MapBox imports in case no style is defined. defaultStyle is an ol.style.Style object.
Optional
display?: booleandisplay tools editor
Optional
editor?: anyoptions for tools editor
Optional
webServicesOptions?: { noProxyDomains?: string[]; proxyUrl?: string }Options to import WMS or WMTS layers
Optional
noProxyDomains?: string[]Proxy will not be used for this list of domain names. Only use if you know what you're doing.
Optional
proxyUrl?: stringProxy URL to avoid cross-domain problems. Mandatory to import WMS and WMTS layer.
var LayerImport = new ol.control.LayerImport({
"collapsed" : false,
"draggable" : true,
"layerTypes" : ["KML", "GPX"],
"webServicesOptions" : {
"proxyUrl" : "http://localhost/proxy/php/proxy.php?url=",
"noProxyDomains" : []
},
"vectorStyleOptions" : {
"KML" : {
extractStyles : true,
defaultStyle : new ol.style.Style({
image : new ol.style.Icon({
src : "data:image/png;base64....",
size : [51, 38],
}),
stroke : new ol.style.Stroke({
color : "#ffffff",
width : 7
}),
fill : new ol.style.Fill({
color : "rgba(255, 183, 152, 0.2)"
}),
text : new ol.style.Text({
font : "16px Sans",
textAlign : "left",
fill : new ol.style.Fill({
color : "rgba(255, 255, 255, 1)"
}),
stroke : new ol.style.Stroke({
color : "rgba(0, 0, 0, 1)",
width : 2
})
})
})
},
"GPX" : {
defaultStyle : new ol.style.Style({
image : new ol.style.Icon({
src : "path/to/my/icon.png",
size : [51, 38],
}),
stroke : new ol.style.Stroke({
color : "#ffffff",
width : 7
})
})
}
}
});
Protected
disposedThe object has already been disposed.
Protected
listenerKey name.
Listener.
Type.
Listener.
Protected
applyProtected
Apply any properties from another object without triggering events.
The source object.
Dispatches an event and calls all listeners listening for events
of this type. The event parameter can either be a string or an
Object with a type
property.
Event object.
false
if anyone called preventDefault on the
event object or if any of the listeners returned false.
Clean up.
Protected
disposeProtected
Extension point for disposable objects.
Returns true if widget is collapsed (minimized), false otherwise
collapsed - true if widget is collapsed
Get container
container
Get the listeners for a specified event type. Listeners are returned in the order that they will be called in.
Type.
Listeners.
Returns layer name
name - layer name
Get an object of all property names and values.
Object.
Returns content of a service import (GetCapabilities)
contentService - content service
Returns content of a static import (KML, GPX or GeoJSON)
contentStatic - content static
Optional
type: stringType. If not provided,
true
will be returned if this event target has any listeners.
Has listeners.
The object has properties.
Key name.
Old value.
Protected
onceProtected
onKey name.
Listener.
Type.
Listener.
Collapse or display widget main container
True to collapse widget, False to display it
Overwrite OpenLayers setMap method
Map.
This function is used to set a target element for the control. It has no
effect if it is called after the control has been added to the map (i.e.
after setMap
is called on the control). If no target
is set in the
options passed to the control constructor and if setTarget
is not called
then the control is added to the map's overlay container.
Target.
Protected
unProtected
Unlisten for a certain type of event.
Type.
Listener.
options for function call.