WebMap.js, aka OpenLayers Profiles

Christopher Schmidt crschmidt at metacarta.com
Wed Dec 6 20:08:09 EST 2006


(I meant to send this more than a month ago -- sorry about that.)

At the FOSS4G conference, members of the OSGeo web mapping development
community met and agreed to begin developing towards a single basic
client-side web map rendering library that can be used across the
various projects in the community.  The OpenLayers development team
volunteered to work on the first cut of this library, using the
!OpenLayers library as a base.  To achieve this goal, we have formalized
the notion of 'profiles' in the OpenLayers build process and
created a 'lite' build profile.

The desired characteristics were described as:
 * Containing a minimal framework for creating applications, with the
   ability to easily add additional components.
 * Free of Prototype.js constructs which break Javascript functionality,
   primarily the `Object.extend` method, which broke the ability to
   iterate over the properties of an object.

As described during that meeting, these desires can be met using:
 * a 'Map class'' defining general properties of the map, such as
   projection, which are by default passed onto the layers in the map.
 * 'Event handling' functionality including the ability to register
   listeners to events which occur, and to control the map and cause
   those events to occur.
 * a 'Layer class', providing a framework for describing how content
   should be included in the Map.
 * Layer support for ''Gridded WMS requests'', providing the minimal
   amount of layer support to allow the lightweight version to display
   map imagery using WMS.

The 'lite' build profile achieves these goals and is included in
OpenLayers v2.2.  It contains the ability to create a map,
add a WMS layer, and control that map via JavaScript calls.  Build
profiles allow anyone to build a single-file JavaScript library
containing whatever parts they desire, these and more.

To build this light version of the library:
  * Download and extract OpenLayers 2.2
  * `cd build`
  * `sh ./build.sh lite`

When run with the 'lite' parameter, this script creates a single-file
script that includes the following files:

{{{
 OpenLayers/SingleFile.js
 OpenLayers.js
 OpenLayers/BaseTypes.js
 OpenLayers/Util.js
 OpenLayers/Events.js
 OpenLayers/Map.js
 OpenLayers/Layer.js
 OpenLayers/Layer/Grid.js
 OpenLayers/Layer/HTTPRequest.js
 OpenLayers/Layer/WMS.js
 OpenLayers/Layer/WMS/Untiled.js
 OpenLayers/Tile.js
 OpenLayers/Tile/Image.js
}}}

The result of running the build.sh script is a new OpenLayers.js file
that will include the functions of all files selected by the input
profile name.  The functions in files chosen by 'lite' are sufficient to
create an OpenLayers map without any additional files.  An example of
using the 'lite' library is available in the "examples" directory,
called `lite.html`.

To add additional parts of OpenLayers to your single file, you can
simply modify the `lite.cfg` file (or copy it to another name), and add
the code that meets your needs. In this way, any user can create a
minimal build which includes only the code needed by their project.

We look forward to hearing your feedback as you look at the code
available via OpenLayers.  To avoid duplicating effort, we would like
to integrate any code based on this framework into the OpenLayers
project, so other projects can concentrate on application-specific
interactions. 

As part of creating a project to which more people contribute, we have
also expanded the committers list to the OpenLayers Subversion
repository.  For more information on becoming a committer, see
"How to Contribute", on the OpenLayers wiki.


http://trac.openlayers.org/wiki/HowToContribute

http://trac.openlayers.org/wiki/Profiles

Regards,
-- 
Christopher Schmidt
MetaCarta




More information about the Webmap-discuss mailing list