OpenLayers Blog

All the maps that are fit to blog

Nottingham Sprint, Wednesday 18th Sept

September 11th, 2013 by Tim Schaub · 5 Comments

If you’re planning on going to FOSS4G and are interested in OpenLayers 3, please join us for an open sprint on Wednesday 18th Sept on the University of Nottingham campus (Humanities A3). Core developers of the library will be on hand, and contributors of all sorts are welcome. We’ll start off with an overview of the library and a discussion about the current status and future plans. Please come at 10:00 AM to catch the introduction. We should be at the venue until around 5:00 PM.

See the campus map below for the location. We’ll be in Humanities A3, marked as #55 on the map.

Humanities A3 (#55)

We look forward to seeing you there!

→ 5 CommentsTags: Conferences · Sprint

OpenLayers r3.0.0-alpha.4

July 29th, 2013 by ahocevar · 7 Comments

OpenLayers r3.0.0-alpha.4 is released.

For maps that have a defined extent that viewers should be able to return to, OpenLayers 3 now has a ZoomToExtent control.

As an internal preparation for SelectFeature control and vector editing, the canvas vector renderer can now deal with addition and removal of features. Another vector related improvement that results in a user facing API simplification is that the ol.source.Vector is now responsible for fetching vector data from the server. This means that users no longer need to parse features on the application level. Preparing for styling vector layers with CSS, the internal API now has getters and setters for symbolizer properties.

On the documentation and examples front, we have removed css loading from the example loader. This should avoid confusion, because previously when users looked at examples it was not obvious how the library css is loaded.

The rest of the issues closed for this alpha release are related to bug fixes, and internal refactoring.

Some of the work that is currently being done and that may be included in alpha.5:

We will soon start the transition from alpha to beta. The main task in this transition is to restrict the API to things that are stable already, so we can guarantee API stability throughout the 3.x series.

Stay tuned!

→ 7 CommentsTags: Uncategorized

OpenLayers 3.0.0-alpha.3

July 12th, 2013 by Eric Lemoine · 2 Comments

OpenLayers 3.0.0-alpha.3 is released.

Although OpenLayers 3 supports zooming the map at arbitrary resolutions, it is very often convenient to manipulate zoom levels instead of resolutions. For that reason we’ve added two new functions to ol.View2D: setZoom and getZoom. Along the way we’ve added content to the ol.View2D API doc.

In preparation for efficient Canvas rendering of holes in polygons we now store rings in consistent winding order internally. The next step is to draw holes correctly and efficiently with Canvas. See the interesting discussion in the GitHub issue for more details.

The rest of the issues closed for this alpha release are related to bug fixes, and internal refactoring.

Some of the work that is currently being done and that may be included in alpha.4:

Stay tuned!

→ 2 CommentsTags: Uncategorized

OpenLayers 3.0.0-alpha.2

June 28th, 2013 by Eric Lemoine · 1 Comment

We’ve just tagged 3.0.0-alpha.2. Some of the highlights of this 2nd alpha release include:

Parsers:

  • Add a WKT parser. The parser supports both write and read.
  • Add write support to the GeoJSON parser.
  • Add OGC Filter parser.

Vector:

  • Improve the performance of the vector canvas renderer.
  • Improve canvas rendering of vector data (by not using a fixed tile grid)
  • Add basic support for text symbolizers.
  • Add a skeleton for WebGL vector support.

API changes:

  • Rename the projection package from ol.projection to ol.proj.
  • Change ol.Size to an array.
  • Add addControl and removeControl methods to the map.

Interesting examples (new or improved):

See also the examples index page, and the API doc.

Expect more alpha releases to come! We hope to release alphas every two weeks for some time, keeping the community up-to-date with progress.

Big thanks to those who already contribute to ol3!

→ 1 CommentTags: Uncategorized

OpenLayers 3 Lausanne Sprint Summary

March 18th, 2013 by Eric Lemoine · 12 Comments

A group of nine developers gathered in Lausanne or participated remotely in an OpenLayers 3 sprint just over a week ago. This was an intensive, productive, and fun week. There’s still a long way to go, but we think OpenLayers 3 is looking great already! This post reports on the code sprint’s achievements and discussions.

Vector

During the sprint, work continued on the vector branch – including a new vector layer canvas renderer, vector feature and geometry objects, GeoJSON parsing, rule-based styling with expressions in symbolizers, and WebGL friendly geometry storage.

After a presentation of the current state of the vector branch, we had a long discussion on the architecture and functionality, and talked about efficient geometry storage for WebGL rendering. Our ongoing challenge is to find solutions that enable both rich functionality (complex styling, feature editing, etc.) and displaying lots (millions) of vector features with WebGL.

A few days after the sprint, the vector branch was merged into master, and work has started on the WebGL renderer.

The current state of vector functionality can be summarized as follows:

  • GeoJSON format support. See the vector layer example
  • Tile-based rendering of vector geometries to a 2D canvas.
  • Rendering of points with a circle symbol or icons from image files.
  • Stroke symbolizers (color, width, opacity) for lines and polygons.
  • Fill symbolizers (color, opacity) for polygons.
  • Rule based styling with filters and access to feature data, including support for multiple symbolizers per feature (see the rule-based styling example).
  • Fast rendering thanks to spatial R-Tree indexing and rendering of geometries with the same symbolizer in a single pass.

Parsers

OpenLayers 2 is well known for the various parsers/formats it offers. OpenLayers 3 will be no different. We’ve already ported a number of formats from OpenLayers 2: OGC Exception Report, OGC OWS Common, OGC WMS Capabilities, OGC WMTS Capabilities, and GeoJSON. We’ve also started working on a KML parser, which is not yet merged at time of this writing.

Also, right after the code sprint, we received a great contribution from Tobias Bieniek, who wrote a parser for Google’s Encoded Polyline Format. (Tobias also ported the test suite to Mocha from Jasmine.) Many thanks Tobias!

WMTS layer

We’ve added a new tile source: WMTS. This new source allows displaying tiles served by OGC WMTS services, which is now supported by the major open-source tile servers, like GeoWebCache and MapProxy.

See the WMTS example for a live demo.

OpenLayers 3 also supports creating WMTS source objects from WMTS Capabilities documents (read with the WMTS Capabilities parser mentioned above).

New controls

We have added two new controls: a zoom slider control, and a scale line control. Both are entirely customizable through CSS. See zoom slider and scale line control examples.

The scale line control can work with various units, and it gracefully handles different map projections. Open the scale-line example in your browser, and note that the scale line changes as you zoom, and move to or from the poles. (On mobile it will also change while pinching!)

Interaction improvements

Interactions are objects that make interacting with the map possible. Examples of interactions include DragPan, TouchPan, and TouchZoom, to name a few.

We made a number of improvements to the interactions during the code sprint. The main improvements involve animating every type of interaction. For example, zooming with the mouse wheel is now animated, snapping to the closest zoom level after pinching is now animated.

Speaking about animations, make sure you check out our new animation example.

Canvas renderer

OpenLayers 3 currently has three renderers: DOM, Canvas, and WebGL. We wrote the DOM and WebGL renderers first. Later we added the Canvas renderer because of FireFox and Chrome bugs causing white lines between tiles when zooming and rotating with the DOM renderer. By using Canvas to render tiles the visual artifacts are all gone.

To get very good performance from Canvas we still need to optimize our Canvas renderer implementation. We started work in that area during the code sprint, which involved not redrawing the entire Canvas each time the map is moved or zoomed. There are more optimizations to come.

We believe that we can get very good performance out of the Canvas renderer. Think mobile with many layers, which is known to not work well using the one DOM div per layer paradigm.

For a lot of our examples the renderer can be explicitly set by setting the “renderer” parameter in the URL. For example, the following loads the Stamen example using the Canvas renderer:

http://openlayers.github.com/ol3/master/examples/stamen.html?renderer=canvas

API work

We all know and agree that we need to improve the API, and the code sprint was a good opportunity to talk about, and work on, the API.

It is now possible to pass an array of layers to the map constructor. We also changed the way controls are passed to the map. And finally we made it possible to use strings to specify projections throughout the API. This may sound like small improvements, but designing a consistent and convenient API requires a lot of thinking, discussion around code snippets and developer feedback.

You can browse our examples follow the “source” link to see what the current API looks like.

For example, this is how a map with two Stamen layers is currently created:

var map = new ol.Map({
  layers: [
    new ol.layer.TileLayer({
      source: new ol.source.Stamen({
        layer: 'watercolor'
      })
    }),
    new ol.layer.TileLayer({
      source: new ol.source.Stamen({
        layer: 'terrain-labels'
      })
    })
  ],
  target: 'map',
  view: new ol.View2D({
    center: ol.projection.transform(
        new ol.Coordinate(-122.416667, 37.783333), 'EPSG:4326', 'EPSG:3857'),
    zoom: 12
  })
});

We’re still actively working on the API.

Continuous integration

OpenLayers 3 is very serious with Continuous Integration. We use Travis CI to run and and check a ton of things for us.

During the code sprint we added a check-examples hook that checks that our examples’ HTML pages load without error. Should an example use a symbol that’s not exported by the Closure Compiler the check-examples hook will catch it. Should an example use a WMS that is currently down the check-examples hook will also catch it.

OpenLayers 3 will include lots of examples, so this kind of automated processes is key to maintaining working examples. It is now quite clear that, as we develop OpenLayers 3, we’ll more and more rely on continuous integration.

Examples with Bootstrap

The examples index page and the example pages themselves now use Twitter Bootstrap. This gives us nice-looking pages, and responsive design for accommodating various screen sizes.

For example, open the zoom slider in a mobile browser, and note that the maps are stacked on one another to accommodate the screen size.

→ 12 CommentsTags: Sprint

OL3 Lausanne Sprint Kick-Off

March 2nd, 2013 by Tim Schaub · 4 Comments

Blogging on a saturday?? You bet! Blogging and sprinting even. As part of our ongoing OpenLayers 3 development effort, a number of us are gathering in Lausanne for a short sprint. Our calendars were tight and ambitions high, so we found an opening and made quick travel plans. Today was an OpenGeo gathering; Andreas, Bart, and I spent the day talking about and working on vector functionality. Bart is tackling format parsing, adding KML parsing to the existing GeoJSON support. Andreas is working on rule based styling for vector layers. And I re-worked our internal geometry model to use shared coordinate arrays in preparation for efficient WebGL rendering.

In a couple hours we meet the Camptocamp guys as they get in to town. With Eric, Bruno, Tom, and Fred, we’ll dive into it again tomorrow morning. We’re grateful to Camptocamp for hosting us in their offices and to the OpenLayers 3 sponsors for supporting us in this development effort. Stay tuned for details on our progress.

→ 4 CommentsTags: Sprint

Why are we building OpenLayers 3?

November 14th, 2012 by Eric Lemoine · 29 Comments

A recent blog post by OpenGeo provides one explanation of why the OpenLayers community is working towards OpenLayers 3. On behalf of the OpenLayers development team, we’d like to give a few more details.

OpenLayers 2.0 was released six years ago, and the library has been under continuous development since. It is solid, flexible, and easy to extend. The most recent OpenLayers 2 releases leverage some of the latest browser advances like touch events, CSS transitions, and offline caching. OpenLayers 2 is widely used and provides the features people need for their web mapping applications. Leaflet is another very popular library. Its first version (0.1) was released a year and a half ago. It provides an easy-to-use API, supports mobile and has leveraged CSS 3 from day one.

The point is that these libraries work well for people, and cover their current needs. So why are we doing OpenLayers 3? What are our motivations? Where does OpenLayers 3 fit exactly?

First of all, there are things that we don’t like about OpenLayers 2 — things we want to see fixed in the next major OpenLayers version. One example is the base layer/overlay dichotomy. It is often a challenge to know how and where to set resolutions, maxExtent, etc. for the map. Projection handling between map and layers and the interplay between projection and properties like maxExtent and center are complicated at best. Even power users may be confused at times.

So it’s no surprise that we want to fix these design and API flaws with OpenLayers 3. But we actually want a lot more than that. We’re looking at new functionality, new platforms, and new technologies. In particular, we’re targeting 3D, at least some form of 3D. For example, we’d like to support displaying terrain and building elevations with oblique views. That by no way means we’re forgetting about “simple” 2D use cases, nor are we dropping support for less capable browsers. OpenLayers 3 needs to be a high-performance, easy-to-use toolkit that works in as many browsers as possible, gracefully degrading when necessary.

WebGL is the emerging standard for 3D in the browser. So OpenLayers 3 will leverage WebGL from the very start of its development — it already does actually. We’ve started developing a map renderer abstraction, allowing different map renderer implementations. Currently there are two map renderers: a traditional DOM renderer and a WebGL renderer. A canvas 2D map renderer is planned. Taking advantage of WebGL we want to support very large vector layers, client-side re-projection of vector and raster data, 2D tilted/rotated views, and 3D terrain in local projections.

We also aim to integrate with virtual globes like Cesium. Implementing a virtual globe is currently out of OpenLayers 3′s scope, while providing useful integration with Cesium definitely is within scope. We believe that 2D and 3D worlds should converge, with seamless transitions between them.

It’s also possible that there will be integration points between OpenLayers 3 and Leaflet. For example, OpenLayers 3 packages could be built for reading and writing of vector formats, and these packages could be adapted as Leaflet plugins. It could even be that OpenLayers 3 packages would provide an OGC compatibility layer for Leaflet – providing OGC protocol or format support for people who already use Leaflet and want broader interoperability (or vice versa).

It may be obvious that OpenLayers 3 isn’t going to be a micro-framework. Instead, OpenLayers 3 will be a large collection of modules with automated tests and continuous integration ensuring that they always work well together. We think this brings huge benefits to application developers, particularly for the maintenance of long-lived, large-scale projects: being able to update a single, tested, integrated library is much easier than tracking several different plug-ins from different sources and having to deal with dependency management and integration problems manually.

OpenLayers 3 is based on the Closure Library, and we rely on the entire Closure tool suite. Our ambitions, in terms of both functionality and quality, require high-quality tools for code verification and optimization. Closure provides quite unique tools in this space. For example, the Closure Compiler produces extremely compact, high performance JavaScript through advanced optimizations like variable and property renaming, unused code removal, and function inlining. JSDoc-style annotations allow the compiler to do type checking, helping developers (us) to produce JavaScript code that has fewer bugs and is easier to extend and maintain. We plan to provide a hosted build tool that will enable people to easily create custom optimized profiles of the library for their application.

We hope this post makes it clear what we have in mind, and why we’re working towards OpenLayers 3 and making it very different from OpenLayers 2.

→ 29 CommentsTags: Future

Crowdfunding OpenLayers 3

November 1st, 2012 by Tim Schaub · 11 Comments

We’ve been getting great feedback on our OpenLayers 3.0 fund raising
effort
, and to help ease contributions from individuals and smaller companies we’ve just launched a crowdfunding campaign on Indiegogo. We’re looking to raise at least $20,000 from users of OpenLayers, to complement larger contributions from big organizations who love OpenLayers.

There are a number of ‘perks’ you can receive for donating, including limited edition OpenLayers t-shirts, your name in the release notes, and participation in the final OpenLayers 3 sprint. If you’ve ever had your work helped by OpenLayers then now is the best possible time to give back.

And please get in touch with ol3-funding@googlegroups.com if you want to help attract larger organizational sponsors to OpenLayers. We’ve got a prospectus for organizations that give them ‘perks’ as well, like their logos prominently featured as supporters and even one year of commercial support on OpenLayers 3.0.

→ 11 CommentsTags: Future

OpenLayers 3 – Call for Funding

October 17th, 2012 by Tim Schaub · 9 Comments

We’re excited to be embarking on a major development effort towards OpenLayers 3. Previous posts have detailed our progress through two concentrated sprints. At this point, we’re confident in the new design and are ready to start porting over existing OpenLayers functionality. We intend for the new library to have the same breadth of functionality as OpenLayers 2 with improvements based on the 5+ year history of the project.

To support the development of OpenLayers 3, we’re kicking off a fundraiser. We’ve already received a generous contribution from a major government mapping agency, and are looking to raise an additional $250,000 by November 30.

OpenLayers 3 leverages the latest in browser advancements, with a full WebGL map renderer and a DOM/CSS based renderer where WebGL is not available. OpenLayers 3 will build on the vector rendering and editing functionality in the current version, supporting standards and community formats and protocols. The new version of the library will focus on performance, with a lightweight build optimized for mobile browsers, and usability, with an overhauled website and learning resource center. We’re excited to be giving OpenLayers a design and performance facelift while maintaining the breadth of functionality that OpenLayers users depend on.

Please get in touch at (ol3-funding@googlegroups.com) if you’re interesting in being involved.

→ 9 CommentsTags: Future

OL3 Vienna Code Sprint Report

September 28th, 2012 by Eric Lemoine · 5 Comments

With the OL3 Vienna Code Sprint coming to its end now is probably a good time for a recap on what we’ve achieved. We have done a lot of work on consolidating the architecture and project infrastructure, and have also added new functionality along the way.

OpenLayers 3 side-by-side example

The above image is screenshot of one of our examples. This example includes two maps, a WebGL map and a DOM map. Both maps are synchronized, when one moves the other moves, when one rotates the other rotates, etc.

Infrastructure

We can now generate the API documentation using jsdoc3. The generated API documentation is very “raw” right now, and would definitely deserve some love. But we at least have a tool that is compatible with the Closure Compiler, with plans for even better compatibility in the future. The API doc is available online.

The Jasmine framework is used for testing. Jasmine provides a nice language for describing test specifications. In addition, Jasmine makes it easy to run tests “headlessly”, i.e. outside any browser window. This allows for Continuous Integration, which we feel is very important given out ambitions and expectations for the project. We need solid foundations from the very start of the project.

We rely on the Travis CI (Continuous Integration) service. Each time new code is pushed to the repository Travis fetches this new code, runs the linter, compiler, and the test suite. Breaking changes are thus immediately identified. Check out the OpenLayers 3 Travis page.

Architecture

We have worked on a flexible system for constraining resolutions and rotation angles. This system allows for easily specifying what the possible resolutions and rotation angles can be. The system is flexible to allow for other types of constraints in the future, for restricting extents for example.

We discussed and worked on the API again. We’re not ready to commit to a final API now, so we’ve focused our efforts on the low-level API we’ll eventually build on, providing conveniences as we go.

Functionality

OpenLayers 3 needs to work on touch devices. Panning the map now works correctly on Android and iOS. The pan performance still needs improving. The zoom control’s + and – buttons are responsive in touch devices, as described in this article and elsewhere.

The DOM renderer now displays interim tiles while new tiles, at a better resolution, are loaded. This prevents getting a blank map while tiles are loading. This change revealed bugs in the DOM renderer code, and required major refactoring.

The WebGL renderer supports map rotations, and we have starting adding this support to the DOM renderer. This is based on CSS3 transforms.

Thanks

We’d like to thank the Research Group Cartography of the Vienna University of Technology again. The venue they offered us turned out to be a perfect place for the sprint.

Note: if you’re interested in the development of OpenLayers 3, please have a look at the roadmap and subscribe to the ol3-dev google group.


Our task tracking tool for this sprint:

OpenLayers 3 Sprint Tasks

→ 5 CommentsTags: Uncategorized