OpenLayers 2.4 Release Notes
As of 2.4-RC1, the OpenLayers 2.4 release closes 106 outstanding tickets, more than any other OpenLayers release to date.
Table of Contents
- OpenLayers 2.4 adds support for rendering vectors in the browser, using SVG in Mozilla/Firefox and Opera, and VML in Internet Explorer. Thanks a million to Bertil Chaphuis, Pierre Giraud, Cameron Shorter, Olivier Terral, and everyone else who contributed to this massive achievement.
- Currently, there is no vector rendering support for the Safari web browser. The next major release of the browser will include SVG support: If you would like support for vectors in Safari, you can download the latest version from Webkit Nightly Builds.
- OpenLayers 2.4 introduces the following vector geometry types, under the OpenLayers.Geometry.* namespace:
- 2.4 introduces the Feature.Vector class, which is used for connecting geometries to display styling and to feature attributes.
- Serialization and deserialization of vector data formats is managed by the new OpenLayers.Format classes. The following formats are currently implemented:
- OGC GML (v2 only)
- Google KML
- OGC WFS
- OGC WKT ("well-known text")
- The MouseDefaults and MouseToolbar controls have been deprecated, in favor of the new Navigation and NavToolbar controls.
- The default controls added to the map changed slightly in 2.4. Instead of the MouseDefaults control, the Navigation control is added to the map instead. These controls provide the same functionality, but different internal APIs. If you were subclassing off of a default control, you can maintain the old behavior by adding the following option to your map constructor:
controls: [ new OpenLayers.Control.MouseDefaults(), new OpenLayers.Control.PanZoom(), new OpenLayers.Control.ArgParser() ]
- 2.4 introduces the Control.Panel class, which allows for the construction of generic button toolbars. The new MouseToolbar class subclasses this. (#417, #427, #614)
- Mouse wheel zooming now works in a much more intuitive fashion. (#341)
- The PanZoomBar can now be correctly positioned on instantiation. (#610)
- Control.Scale display has been improved. (#331)
- Dragging the extent rectangle on the OverviewMap now does the expected thing. (#621)
OpenLayers now implements a series of Handler classes that encapsulate common user interactions. Handler classes each implement a particular set of callbacks which are triggered on the relevant user interaction. Most of the existing Control classes have been ported to make use of them, hopefully resulting in cleaner Control code and a more consistent user experience. The Handler classes added in 2.4 include:
- Handler.Box -- Capture boxes drawn on the map
- Handler.Drag -- Handle mouse dragging of the map
- Handler.Feature -- Vector feature selection
- Handler.Keyboard -- Process key press events
- Handler.MouseWheel -- Capture mouse wheel events
- Handler.Path -- Handle path drawing on the map
- Handler.Point -- Handle point drawing on the map
- Handler.Polygon -- Handle point drawing on the map
- Layer.Vector has been added, which uses the Renderer.SVG and Renderer.VML classes to display vector data on the map.
- Tiled layers (WMS, MapServer, TMS, etc.) can now be requested with gutters, by adding a 'gutter' option to the layer constructor that specifies the gutter size in pixels. This causes OL to request an image slightly larger than the tile size, and then visually clip the edges, which avoids some of the "edge effects" sometimes seen when tiling map images on the web. (#529)
- Switching base layers now correctly recenters the map (as needed) and redraws marker layers. (#450)
- All Layer classes now trigger loadstart/loadend/loadcancel events, which can be used to "Loading..." spinners and the like. (#452)
- Layer.MapServer has been significantly revamped, and Layer.MapServer.Untiled has been added. Thanks to Paul Spencer and Stephen Woodbridge for getting this working. (#503, #508, #526, #546, #547, #548)
- Layer.Text no longer displays a popup if no text was added to the marker. (#471)
- Layer.GeoRSS now handles Atom 1.0. (#506)
- Layer.Google now goes all the way down to zoom level 20 (#613).
- Layer.WMS, Layer.TMS, and Layer.MapServer now select from a list of URLs consistently for a given tile, thereby better leveraging client-side caching for multi-URL layers. (#410)
- Layer.Boxes.removeMarker() finally works. (#475)
- Marker positions can now be updated. (#519)
- WFS support has been significantly enhanced.
- Layer.WFS now uses Layer.Vector to display non-point layers.
- Limited support for WFS-T has been added.
- The WFS layer is now Untiled. Instead of making many requests, it will only make one, and that single request will by default be for an area twice the size of the viewable map. You can adjust this with a 'ratio' option on the layer.
- The WFS Tile internal naming changed from using a "urls" parameter on the Tile, which was an array of strings, to 'url', which is a single string, to be more in line with other tile types. Users who have extended the WFS Tile in some way may need to modify their code to support this.
- If no featureClass is specified as an option to the WFS layer, the layer will by default display using vectors instead of markers.
- Internet Explorer does not have a built in XML Serializer, so it can not save WFS-T payloads to a server via the 'commit' method on a WFS layer. (Tracked in bug number #535)
- Safari's built in XML Serializer does not maintain namespaces, so it can not save WFS-T payloads to a server via the 'commit' method on a WFS layer. (#536)
- Significant bug fixes in event handling code, drastically reducing memory leaks (#568, #585, #603, #604, #623, #624, #625)
- Generally, a great deal of work has gone into properly destroying circular object references and unneeded references to DOM elements. (#510, #549, #572, #574, #576, #577, #578, #581, #591, #596, #601)
- Resizing the window or moving the map div no longer permanently messes up the mouse location. (#383)
- OpenLayers.Map now supports a 'fallThrough' option that permits browser events to "fall through" the map to the document around it. (#457)
- CSS support has been improved, so that OL element styling can now be overriden by the user. (#460)
- OpenLayers API documentation is now partially generated via JSDoc. (#418)