[OpenLayers-Users] Help with Strategy.save and protocol.http

Frank Broniewski brfr at metrico.lu
Wed May 19 10:44:59 EDT 2010


Hello all,

I am currently (virtually ;-))fighting to understand how I can make an 
editable layer in OpenLayers. Especially the connection between the 
save-strategy and the protocol is difficult to understand. I already 
searched the docs and the mailing list, but was unable to find some kind 
of definition what exactly a strategy or a protocol is and for what kind 
of "behavoir" they are responsible.

I managed to create a working example, where I could edit/create/modify 
features and the changes were sent to my server but I really lack 
understanding how things work together ...

var points = new OpenLayers.Layer.Vector(
	'Viaah Points',
	{
		'protocol' : new OpenLayers.Protocol.HTTP(
				{
				'url' : '/my/layer.geojson',
				'format' : new OpenLayers.Format.GeoJSON()
				}
		),
		'strategies' : [
			new OpenLayers.Strategy.BBOX(),
			new OpenLayers.Strategy.Save({auto:true})
		]
	}
);

I added a standard editing toolbar, and with the auto:true save-strategy 
I could see the requests sent to the server in firebug.

 From what I have guessed so far: Is it true that the save-strategy uses 
the protocols methods for read/update/create/delete depending on the 
edit-actions taken by the user? And I presume it's somewhat hard-coded, 
that updates are done by a HTTP PUT, create by HTTP POST etc. ? In the 
mailing lists post I often saw a callback function mentioned for the 
protocol - does this function get called after the request has been sent 
to the server?

I am sure I have more questions, but these are the most basic ones 
concerning editing of features. Any info on these internals is greatly 
welcome

Frank



-- 
Frank BRONIEWSKI

METRICO s.à r.l.
géomètres
technologies d'information géographique
rue des Romains 36
L-5433 NIEDERDONVEN

tél.: +352 26 74 94 - 28
fax.: +352 26 74 94 99
http://www.metrico.lu



More information about the Users mailing list