[OpenLayers-Users] Need help on the best way to approach feature attribute editing

Stephen Woodbridge woodbri at swoodbridge.com
Fri Mar 12 18:19:10 EST 2010


Hi all,

I'm stuck on the best conceptual approach to editing feature attributes 
and could really use some feedback or other ideas. In part because I 
think I'm too tangled in all the code parts and have lost the big picture.

So at a high level I need:

1) base map - check works fine
2) vector layer pulling data from server - check works fine
3) toolbar with [Nav][createPOI][dragPOI][selectPOI] - check have this 
but might need to rethink it
4) [createPOI]
   a) needs to take click on map - check, works fine
   b) open popup to allow setting attribute, check have this but ...
   c) have [cancel] to abort creation - have button but how to abort
   d) have [save] to write the data to the server - have button but how 
to save
   e) update layer with new feature - not sure the best way to do this.
     1) get return gid from server, add it to feature, and feature to layer
     2) destroy the temporary feature, and have server return a complete 
feature that gets added to layer
     3) not sure how to hook either of these into the code
5) [dragPOI] - check works, needs a myXML writer I think
6) [selectPOI] - check, have this but not everything works
   a) open popup to allow editing attributes - check have this, but ...
   b) have [delete] which will delete the feature
   c) have [cancel] which will cancel the edits
   d) have [save] which will save the edits to the server
   e) update the layer with the modified feature - again see [createPOI]

So where I'm getting caught up is that in form button onClick function 
you really do not know what feature you are dealing with so I guess that 
means that the selected feature needs to be listening for events 
"abort", "cancel" and "save" that correspond to the buttons. and all the 
function should try to do is trigger the appropriate event. And that the 
listener should also have the responsibility for closing the popup.

1) So where should the listener be attached, I suppose to the vector 
layer as Alexandre suggested in earlier email, but that did compute yet.

2) thoughts on best practice for updating the modified features?

The code in question is at:
http://imaptools.com:8080/tilecache/test.html?zoom=17&lat=33.89595&lon=35.49935&layers=BT

All thoughts and suggestions are welcome and appreciated,
   -Steve (who will be working all weekend on this)



More information about the Users mailing list