Namespace: ol

ol


Classes

AssertionError
Attribution
CanvasMap
Collection
DeviceOrientation
Disposable
Feature
Geolocation
Graticule
Image
ImageBase
ImageTile
Kinetic
Map
MapBrowserEvent
MapEvent
Object
Observable
Overlay
PluggableMap
Sphere
Tile
VectorTile
View

Namespaces

color
colorlike
control
coordinate
easing
events
extent
featureloader
format
geom
has
interaction
layer
loadingstrategy
proj
render
renderer
source
style
tilegrid

Methods

ol.inherits(childCtor, parentCtor)

src/ol/index.js, line 215

Inherit the prototype methods from one constructor into another.

Usage:

function ParentClass(a, b) { }
ParentClass.prototype.foo = function(a) { }

function ChildClass(a, b, c) {
  // Call parent constructor
  ParentClass.call(this, a, b);
}
ol.inherits(ChildClass, ParentClass);

var child = new ChildClass('a', 'b', 'see');
child.foo(); // This works.
Name Type Description
childCtor function

Child constructor.

parentCtor function

Parent constructor.

Type Definitions

ol.AttributionLike{string} {Array.<string>} {ol.Attribution} {Array.<ol.Attribution>}

A type that can be used to provide attribution information for data sources.

It represents either

  • a simple string (e.g. '© Acme Inc.'),
  • an array of simple strings (e.g. ['© Acme Inc.', '© Bacme Inc.']),
  • an instance of ol.Attribution,
  • or an array with multiple ol.Attribution instances.

ol.CanvasFunctionType()

src/ol/typedefs.js, line 76

A function returning the canvas element ({HTMLCanvasElement}) used by the source as an image. The arguments passed to the function are: ol.Extent the image extent, {number} the image resolution, {number} the device pixel ratio, ol.Size the image size, and ol.proj.Projection the image projection. The canvas returned by this function is cached by the source. The this keyword inside the function references the ol.source.ImageCanvas.

ol.Color{Array.<number>}

A color represented as a short array [red, green, blue, alpha]. red, green, and blue should be integers in the range 0..255 inclusive. alpha should be a float in the range 0..1 inclusive. If no alpha value is given then 1 will be used.

ol.ColorLike{string} {CanvasPattern} {CanvasGradient}

A type accepted by CanvasRenderingContext2D.fillStyle or CanvasRenderingContext2D.strokeStyle. Represents a color, pattern, or gradient. The origin for patterns and gradients as fill style is the top-left corner of the extent of the geometry being filled.

ol.Coordinate{Array.<number>}

An array of numbers representing an xy coordinate. Example: [16, 48].

ol.CoordinateFormatType()

src/ol/typedefs.js, line 157

A function that takes a ol.Coordinate and transforms it into a {string}.

ol.DragBoxEndConditionType()

src/ol/typedefs.js, line 166

A function that takes a ol.MapBrowserEvent and two ol.Pixels and returns a {boolean}. If the condition is met, true should be returned.

ol.DrawGeometryFunctionType()

src/ol/typedefs.js, line 177

Function that takes an array of coordinates and an optional existing geometry as arguments, and returns a geometry. The optional existing geometry is the geometry that is returned when the function is called without a second argument.

ol.EventsConditionType()

src/ol/typedefs.js, line 186

A function that takes an ol.MapBrowserEvent and returns a {boolean}. If the condition is met, true should be returned.

ol.EventsKey{Object}

Key to use with ol.Observable#unByKey.

ol.Extent{Array.<number>}

An array of numbers representing an extent: [minx, miny, maxx, maxy].

ol.FeatureLoader()

src/ol/typedefs.js, line 239

ol.source.Vector sources use a function of this type to load features.

This function takes an ol.Extent representing the area to be loaded, a {number} representing the resolution (map units per pixel) and an ol.proj.Projection for the projection as arguments. this within the function is bound to the ol.source.Vector it's called from.

The function is responsible for loading the features and adding them to the source.

ol.FeatureStyleFunction()

src/ol/typedefs.js, line 250

A function that returns an array of styles given a resolution. The this keyword inside the function references the ol.Feature to be styled.

ol.FeatureUrlFunction()

src/ol/typedefs.js, line 263

ol.source.Vector sources use a function of this type to get the url to load features from.

This function takes an ol.Extent representing the area to be loaded, a {number} representing the resolution (map units per pixel) and an ol.proj.Projection for the projection as arguments and returns a {string} representing the URL.

ol.ImageLoadFunctionType()

src/ol/typedefs.js, line 302

A function that takes an ol.Image for the image and a {string} for the src as arguments. It is supposed to make it so the underlying image ol.Image#getImage is assigned the content specified by the src. If not specified, the default is

function(image, src) {
  image.getImage().src = src;
}

Providing a custom imageLoadFunction can be useful to load images with post requests or - in general - through XHR requests, where the src of the image element would be set to a data URI when the content is loaded.

ol.LoadingStrategy()

src/ol/typedefs.js, line 355

A function that takes an ol.Extent and a resolution as arguments, and returns an array of ol.Extent with the extents to load. Usually this is one of the standard ol.loadingstrategy strategies.

ol.OverlayPositioning{string}

Overlay position: 'bottom-left', 'bottom-center', 'bottom-right', 'center-left', 'center-center', 'center-right', 'top-left', 'top-center', 'top-right'

ol.Pixel{Array.<number>}

An array with two elements, representing a pixel. The first element is the x-coordinate, the second the y-coordinate of the pixel.

ol.ProjectionLike{ol.proj.Projection} {string} {undefined}

A projection as ol.proj.Projection, SRS identifier string or undefined.

ol.RasterOperation()

src/ol/typedefs.js, line 447

A function that takes an array of input data, performs some operation, and returns an array of ouput data. For pixel type operations, the function will be called with an array of pixels, where each pixel is an array of four numbers ([r, g, b, a]) in the range of 0 - 255. It should return a single pixel array. For 'image' type operations, functions will be called with an array of https://developer.mozilla.org/en-US/docs/Web/API/ImageData and should return a single https://developer.mozilla.org/en-US/docs/Web/API/ImageData. The operations are called with a second "data" argument, which can be used for storage. The data object is accessible from raster events, where it can be initialized in "beforeoperations" and accessed again in "afteroperations".

ol.RenderOrderFunction()

src/ol/typedefs.js, line 472

A function to be used when sorting features before rendering. It takes two instances of ol.Feature or ol.render.Feature and returns a {number}.

ol.SelectFilterFunction()

src/ol/typedefs.js, line 515

A function that takes an ol.Feature or ol.render.Feature and an ol.layer.Layer and returns true if the feature may be selected or false otherwise.

ol.Size{Array.<number>}

An array of numbers representing a size: [width, height].

ol.StyleFunction()

src/ol/typedefs.js, line 617

A function that takes an ol.Feature and a {number} representing the view's resolution. The function should return a ol.style.Style or an array of them. This way e.g. a vector layer can be styled.

ol.StyleGeometryFunction()

src/ol/typedefs.js, line 627

A function that takes an ol.Feature as argument and returns an ol.geom.Geometry that will be rendered and styled for the feature.

ol.StyleRenderFunction()

src/ol/typedefs.js, line 638

Custom renderer function. Takes two arguments:

  1. The pixel coordinates of the geometry in GeoJSON notation.
  2. The olx.render.State of the layer renderer.

ol.TileCoord{Array.<number>}

An array of three numbers representing the location of a tile in a tile grid. The order is z, x, and y. z is the zoom level.

ol.TileLoadFunctionType()

src/ol/typedefs.js, line 665

A function that takes an ol.Tile for the tile and a {string} for the url as arguments.

ol.TileUrlFunctionType()

src/ol/typedefs.js, line 697

ol.source.Tile sources use a function of this type to get the url that provides a tile for a given tile coordinate.

This function takes an ol.TileCoord for the tile coordinate, a {number} representing the pixel ratio and an ol.proj.Projection for the projection as arguments and returns a {string} representing the tile URL, or undefined if no tile should be requested for the passed tile coordinate.

ol.TransformFunction()

src/ol/typedefs.js, line 708

A transform function accepts an array of input coordinate values, an optional output array, and an optional dimension (default should be 2). The function transforms the input coordinate values, populates the output array, and returns the output array.

ol.WFSFeatureCollectionMetadata{Object}

Number of features; bounds/extent.

ol.WFSTransactionResponse{Object}

Total deleted; total inserted; total updated; array of insert ids.