Geospatial – Actualités

OpenLayers 3: Code Sprint in Austria

24 avril 2015

At the beginning of April, three Camptocamp’s developers attended the OpenLayers 3 Code Sprint which took place in Schladming (Austria). With this blog post, we would like to provide details on some of the work the Camptocamp team did at this code sprint.

Rendering tests

Since our work on drawing points with WebGL, we wanted to add « rendering tests » to the library. Drawing features with WebGL is quite complex, so we’ve always felt that having a way to test the library’s rendering output was mandatory for the future.

So we worked on a rendering test framework and actual rendering tests during the Code Sprint. The rendering test framework is based on the Resemble.js library for image comparison, and on the Slimer JS scriptable browser for running rendering tests in an headless way on Travis CI.

Slimer JS is similar to PhantomJS, except that it is based on Gecko, the browser engine of Mozilla Firefox. Contrary to PhantomJS, Slimer JS supports Canvas as well as WebGL, which was one of the main requirements for us.

Compile your OpenLayers 3 apps with Closure Compiler

At Camptocamp, we compile our JavaScript applications with the Closure Compiler. The Closure Compiler allows for high compression rates, and, based on annotations in the code, « type-checks » the JavaScript code. The Closure Compiler is a very good tool for maintaining large JavaScript code bases with high constraints in terms of performance.

At the Code Sprint in Schladming, we improved closure-util, our node-based tool for Closure, to make using the Closure Compiler in OpenLayers 3 applications much easier. We also wrote a tutorial showing how to compile applications together with OpenLayers 3. The tutorial will become an official OpenLayers 3 tutorial when OpenLayers v3.5.0 will be released (beginning of May 2015).

Drawing Lines and Polygons with WebGL

Some time ago, we added support for drawing points with WebGL to the library. This work was sponsored by Météorage, which uses OpenLayers 3 and WebGL to draw large number of lightning impacts on a map.

But this was just a first step towards WebGL vector support in OpenLayers 3. Obviously, we also wanted to support drawing lines, polygons and labels.

We took the opportunity of the Code Sprint to take a stab at it! We worked on a first implementation, to demonstrate the feasibility, and verify that the current rendering architecture will work for WebGL lines and polygons.

The results are so far encouraging, and we’re looking forward to continuing this work. Check out the dedicated blog post we wrote for more detail.

Vector extrusion with ol3-cesium

We added support to the KML parser for reading extrude and altitudeMode values that may be associated to geometries in KML documents. With some additions to ol3-cesium, the extrude and altitudeMode values may be used to, for example, display extruded buildings in the Cesium globe. See the ol3-cesium extrude example for a demo.

Vector Tiling

OpenLayers 3 already includes basic support for decoding and rendering Vector Tiles. See the tile-vector example for example.

But OpenLayers 3 doesn’t yet support the MapBox Vector Tile Spec, and rendering artefacts may be present at tile boundaries for polygon features with outlines/strokes. We think that full support for Vector Tiles is important for the library, so our goal is to fill the gaps.

At the Code Sprint, we started working on an OpenLayers 3 format for decoding MapBox Vector Tiles and creating vector objects that can be exploited by the library. We also discussed and designed rendering strategies that we could use for properly displaying Vector Tiles. We wanted to experiment with buffered Vector Tiles and clipping at rendering time to prevent rendering problems at tile boundaries.

We think that Vector Tiles present a number of advantages over standard/current vector strategies. To name a few: data caching, data simplification performed once on the server, natural index formed by the tiles, compact and efficient format.

We’re then looking forward to improving the support for Vector Tiles in OpenLayers 3 and making Vector Tiles as mainstream as possible for application developers.

Feel free to contact us if you want to discuss these topics with us!

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *