With version 3, the OpenLayers web mapping library was fundamentally redesigned. The widely used version 2 dates from the early days of Javascript development, and was increasingly showing its age. So it has been rewritten from the ground up to use modern design patterns.

The initial release aims to support much of the functionality provided by version 2, with support for a wide range of commercial and free tile sources, and the most popular open-source vector data formats. As with version 2, data can be in any projection. The initial release also adds some additional functionality, such as the ability to easily rotate or animate maps.

It is also designed such that major new features, such as displaying 3D maps, or using WebGL to quickly display large vector data sets, can be added in later releases.

Google Closure

OpenLayers was written in a way so it can be compiled with Closure Compiler. Its 'advanced' compilation mode offers a level of compression that exceeds anything else available.

Public API

Using the advanced optimizations of the Closure Compiler means that properties and methods are renamed – longMeaningfulName might become xB – and so are effectively unusable in applications using the library. To be usable, they have to be explicitly exported. This means the exported names, those not renamed, effectively become the public API of the library. These exportable properties and methods are marked in the source, and documented in the API docs. This is the officially supported API of the library. A build containing all these exportable names is known as a full build. A hosted version of this is available, which can be used by any application.

Custom Builds

Unlike in, say, Node, where a module's exports are fixed in the source, with Closure Compiler, exports can be defined at compile time. This makes it easy to create builds that are customized to the needs of a particular site or application: a custom build only exports those properties and methods needed by the site or application. As the full build is large, and will probably become larger as new features are added to the API, it's recommended that sites create a custom build for production software.

Renderers and Browser Support

The library currently includes two renderers: Canvas and WebGL. Both of them support both raster data from tile/image servers, and vector data; WebGL however does not support labels. Clearly only those browsers that support Canvas can use the Canvas renderer. Equally, the WebGL renderer can only be used on those devices and browsers that support WebGL.

OpenLayers runs on all modern browsers that support HTML5 and ECMAScript 5. This includes Chrome, Firefox, Safari and Edge. For older browsers and platforms like Internet Explorer (down to version 9) and Android 4.x, polyfills for requestAnimationFrame and Element.prototype.classList are required, and using the KML format requires a polyfill for URL.

The library is intended for use on both desktop/laptop and mobile devices.

Objects and Naming Conventions

The top-level namespace is ol (basically, var ol = {};). Subdivisions of this are:

Class namespaces, such as ol.layer have a base class type with the same name, such as ol.layer.Layer. These are mainly abstract classes, from which the other subclasses inherit.

Source files are similarly organised, with a directory for each class namespace. Names are however all lower-case, for example, ol/layer/vector.js.

OpenLayers follows the convention that the names of private properties and methods, that is, those that are not part of the API, end in an underscore. In general, instance properties are private and accessed using accessors.