[OpenLayers-Dev] proposal: map.addLayer(object) as well as instance

Jachym Cepicky jachym.cepicky at gmail.com
Wed Oct 5 14:22:48 EDT 2011


Hi,

it probably would be nice to have ExtJS-like possibility to initialize 
objects (I would start with layers).

Now, you *have* to create instance of OpenLayers.Layer and than the 
object can be added to map

map.addLayer(new OpenLayers.Layer.WMS(name,url, params, options));

What do you think about a option, that you would have to submit 
object-like definition only:

map addLayer({
	CLASS_NAME: "OpenLayers.Layer.WMS",
	name: "my name",
	params: {
			layers: "0",
			version: "1.3.0"
		},
	options: {
			isBaseLayer: false
		}
	});

It should not be too complicated to put such method in OpenLayers.Map 
object.

What do you think, shall I write some proposal-patch, or do all agree, 
that it is not needed at all?

Jachym


More information about the Dev mailing list