[OpenLayers-Users] Multi User edit on same Map

Greg Allensworth gregor at greeninfo.org
Thu Dec 22 14:01:27 EST 2011


I've not tried to do exactly what you're describing, but I imagine it 
would go something like this:

* The car is a Feature.Vector with an icon, and the Layer.Vector has a 
ModifyFeature control attached to it to allow the point features to be 
edited (the cars to be dragged).

* The layer has a featuremodified event handler, which sends an update 
to the server in usual AJAX fashion. As such, the server can update its 
own database of the features -- which you surely wanted to do anyway, 
especially to set up the map initially, right?

So, that was the "send my updates to the server" component.

For the "update my map from the server periodically" component:

* Also, in the page has a function which is called via setInterval() It 
fetches features from the server, say in GeoJSON format, and updates 
them on the map. The handler would iterate over layer.features, check 
ID#s or "last modified" timestamps or some such, and delete-and-replace 
the features as appropriate.

* The simplest way to update the map would be layer.refresh() but that 
may not be wholly suitable: the layer would flicker a bit as it 
refreshed, and any feature you were in the middle of editing could be 
refreshed and your changes lost. But it may be useful during an interim 
proof-of-concept phase.

* For later development, you could reduce the volume of GeoJSON data by 
filtering by a "last modified time" When a client sends an update, the 
feature's timestamp is updated in the server's database; when a client 
requests an update it sends a note of the last time it requested an 
update so only very-recent changes are downloaded.


Anyway, those are some off the cuff thoughts. Will that help get you 
started?

-- 
Greg Allensworth, Web GIS Developer
BS  A+  Network+  Security+  Linux+  Server+
GreenInfo Network - Information and Mapping in the Public Interest
564 Market Street, Suite 510  San Francisco CA 94104
PH: 415-979-0343 x302  FX: 415-979-0371    email: gregor at greeninfo.org
Web: www.GreenInfo.org     www.MapsPortal.org

Subscribe to MapLines, our e-newsletter, at www.GreenInfo.org


More information about the Users mailing list