[OpenLayers-Users] saving multiple layers

Kris Geusebroek kgeusebroek at xebia.com
Thu Dec 17 07:31:46 EST 2009


Hi

I do it like this and it seems to work ;-)

	point.strategies[1].save();
		line.strategies[1].save();
		poly.strategies[1].save();

so I don't need a variable to hold the strategy and I can just create the layer with a new save strategy

Cheers Kris

-----Original Message-----
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] On Behalf Of Marco Scheuble
Sent: Thursday, December 17, 2009 11:45 AM
To: users at openlayers.org
Subject: [OpenLayers-Users] saving multiple layers

Hi list,

I have a problem with saving multiple editable VectorLayers.

I have three layers: point, line, poly that are editable.
For each layer I first tried to take one saveStrategie for all layers, 
but that didn't work.
It only saved the changes of the last defined layer.

Then I tried it with three different Strategies, but it didn't work too.
So what do I have to do?

Cheers, Marco

-----------------------------
     savepoint = new OpenLayers.Strategy.Save();
     saveline = new OpenLayers.Strategy.Save();
     savepoly = new OpenLayers.Strategy.Save();

var poly  = new OpenLayers.Layer.Vector( 'Flächen', {
         strategies: [new OpenLayers.Strategy.BBOX(), savepoly ],
        ...
         });

var line  = new OpenLayers.Layer.Vector( 'Linie', {
         strategies: [new OpenLayers.Strategy.BBOX(), saveline ],
        ...
         });

var point  = new OpenLayers.Layer.Vector( 'Punkt', {
         strategies: [new OpenLayers.Strategy.BBOX(), savepoint ],
        ...
         });

function save(){
     switch (drawMod){
         case "point":
             savepoint.save();
             break;
         case "line":
             saveline.save();
             break;
         case "poly":
             savepoly.save();
             break;
     }
}
--------------------------
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users



More information about the Users mailing list