-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

OpenLayers 2.10 Beginner's Guide

The options parameter is something that is present in all Layer classes, so let's get a bit more familiar with it. I suggest opening up the Layer documentation and following along, and even trying to add in the options yourself from the possible list of layer properties (at http://dev.openlayers.org/docs/files/OpenLayers/Layer-js.html).
Use the template (or code from Chapter 1 with the WMS layer code removed). We'll be adding some WMS layers, and we'll refer to this file as chapter_3_ex2_options_config.html
.
First we'll add in a layer that contains the 'basic'
layer from the WMS server, like in the previous example.
// Setup our two layer objects var wms_layer_map = new OpenLayers.Layer.WMS( 'Base layer', 'http://vmap0.tiles.osgeo.org/wms/vmap0', {layers: 'basic'}, {isBaseLayer: true} );
Next we'll create another layer object. We'll create a layer using labels, like in the previous example. This time though, let's set the layer's options...
Change the font size
Change margin width
Change background colour