OpenLayers Blog

All the maps that are fit to blog

OL3 Sprint

June 21st, 2012 by Eric Lemoine · 4 Comments

We are a group of seven people working on a new major version of OpenLayers this week:  Marc Jansen (Terrestris), Mike Adair (DM Solutions), Petr Pridal (KlokanTech / MZK), Tim Schaub (OpenGeo), Andreas Hocevar (OpenGeo), Tom Payne (Camptocamp), and myself (Eric Lemoine, Camptocamp).

Our goal for this sprint is to lay the foundations of what will be OpenLayers version 3. We have been talking about the high-level architecture, the API, and the tools we want to use for developing, building, and documenting the library. The first day was really about sharing ideas and knowledge, and eventually agreeing on a number of things.

We want to support different rendering mechanisms/technologies. We’re envisioning having two built-in renderers in OpenLayers 3, one that works with img/SVG/VML/Canvas (as OL 2), and the other that works with WebGL (Canvas 3D). The WebGL renderer will allow client-side manipulations and transformations of raster and vector data. Eventually it should be possible to tilt the camera, and see things in perspective. The OL 3 architecture will allow adding new renderers in the future, for example to provide some integration with 3D virtual globes.

Supporting multiple renderers requires an appropriate architecture, when the rendering-related code is isolated in specific objects, as opposed to being scattered across the library. (In OL 2 the DOM is omnipresent.)  The architecture we’ve come up with defines three core types: Map, Renderer, and Layer. The map is central, it is the main object with which the app developer interacts with. The map has a renderer, to which it delegates the rendering of the data. When the map is requested to move (either through a user action or programmatically) it sends a “draw” order to its renderer – “draw these layers for this center and resolution”. The renderer will then get data from the layers and render this data on the screen (or <imagine>any other media the renderer supports</imagine>). Layers are really data providers, they’re the interface/facade between the data services and the renderer.

Another thing we’ve been spending time on is the API. We want to provide an elegant and easy-to-use API. Here are a few examples

map = ol.map({
    renderTo: 'map',
    layers: [ol.layer.osm()],
    center: [5, 45],
    zoom: 10
});
Or, written differently:

map = ol.map()
    .renderTo('map')
    .layers([ol.layer.osm()])
    .center([5, 45])
    .zoom(10);
With the new API, the display resolutions, projection, and maximum extent are set on the map. The map is the master, it alone determines what projection and resolution to use. There is no longer a “baselayer” controlling these things.

Once a map is created you can, for example, do map.center() to get the center of the map (an ol.Loc object). And you can do map.center([x, y]) to position the map to a new center. We’re obviously generalizing these jQuery-style getterandsetters across the API.

Another area that has required a fair amount of discussions is whether we want to use an external lib in OpenLayers or not. We have wanted to benefit from the Closure Compiler “advanced” optimizations for a long time. And our Closure fanboys in the room have shown, and eventually convinced, the other sprinters that using the Closure Library is necessary to fully take advantage of the Closure Compiler. So we’ve decided to give a try, without totally committing ourselves to it. I should mention that we’re already observing benefits from the use of the type checker.

That’s all for now. You can follow us on https://github.com/openlayers/ol3.

Tags: Uncategorized

4 responses so far ↓

  • 1 Mel Fegison // Jun 22, 2012 at 4:28 am

    What about Flex API.
    Since Google is closing their Flex API ( really lame idea ) – this is HUDGE oportunity for Openlayers.

    Join forces with OpenScales to produce something really astonishing !

  • 2 Jonah // Jun 25, 2012 at 1:56 pm

    Hey guys, I noticed you mentioned supporting integration with 3D virtual globes in OpenLayers 3. I am not sure if you have seen my post to the dev list about my fork of openlayers where I am working on an adapter for AGI’s Cesium 3D globe for Openlayers. I have made a lot of progress on it since my original post and have a few more examples up on the wiki. Would you guys consider this adapter as an addition to OpenLayers3?

    https://github.com/jktaylor/openlayers/wiki

  • 3 Vince // Jul 26, 2012 at 10:22 am

    OL 3 sounds like good stuff!

    Please fix projection issues when changing base layers. I still didn’t see this fixed in OL 2.11 – had to write a bunch of code extending OL so users could switch base layers of different projections.

    Also, hope you’re considering a subscribe/notify scheme to support state changes in all your components while at the same time decoupling them.

  • 4 The Graphical Web 2012: Tag zwei im Zeichen von WebGIS « terrestris – WebGIS im Intra-/Internet, DesktopGIS sowie Geodatenmanagement mit freier und OpenSource-Software // Sep 12, 2012 at 11:08 am

    [...] von unserem Mitarbeiter Marc Jansen. Insbesondere die Aussicht auf das nächste Major-Release OpenLayers 3 mit Live-Demonstration fand großen Anklang. Grundsätzlich bleibt für die gezeigten [...]