Hi Alexandre,<br>Thanks for the link.<br><br><div class="gmail_quote">2008/10/30 Alexandre Dube <span dir="ltr"><<a href="mailto:adube@mapgears.com">adube@mapgears.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Indika,<br>
<br>
Check out the WFS-T example in this sandbox to see a way of doing it with the WFS protocol : <a href="http://svn.openlayers.org/sandbox/topp/wfs/examples/wfs-protocol-transactions.html" target="_blank">http://svn.openlayers.org/sandbox/topp/wfs/examples/wfs-protocol-transactions.html</a><br>
<br>
Download this svn version and try it. Hope this helps.<br>
<br>
Best regards,<br>
<br>
Alexandre<br>
<br>
Indika Tantrigoda wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">
Hello to all,<br>
I have successfully manged to insert points and a feature attribute to the database. However the modification/deletes seems to giving some trouble.<br>
<br>
Heres the code used.<br>
<br>
controls = {<br>
modifylin: new OpenLayers.Control.ModifyFeature(wfs_cities,<br>
modifyOptions,<br>
{'displayClass': 'olControlModifyFeature'}),<br>
dellin: new OpenLayers.Control.SelectFeature(wfs_cities,<br>
modifyOptions)//,<br>
//{'displayClass' :'olControlModifyFeature'}) <br>
};<br>
<br>
var modifyOptions = {<br>
onModificationStart: function(feature) {<br></div>
OpenLayers.Console.log("start modifying", <a href="http://feature.id" target="_blank">feature.id</a> <<a href="http://feature.id" target="_blank">http://feature.id</a>>); },<br>
onModification: function(feature) {<br>
OpenLayers.Console.log("modified", <a href="http://feature.id" target="_blank">feature.id</a> <<a href="http://feature.id" target="_blank">http://feature.id</a>>); },<br>
onModificationEnd: function(feature) {<br>
OpenLayers.Console.log("end modifying", <a href="http://feature.id" target="_blank">feature.id</a> <<a href="http://feature.id" target="_blank">http://feature.id</a>>);<div class="Ih2E3d">
<br>
feature.state = OpenLayers.State.UPDATE; //alert("Hello");<br>
},<br>
onDelete: function(feature) {<br></div>
OpenLayers.Console.log("delete", <a href="http://feature.id" target="_blank">feature.id</a> <<a href="http://feature.id" target="_blank">http://feature.id</a>>); },<br>
onSelect: function(feature){<br>
OpenLayers.Console.log("select", <a href="http://feature.id" target="_blank">feature.id</a> <<a href="http://feature.id" target="_blank">http://feature.id</a>>); feature.state = OpenLayers.State.DELETE;<div class="Ih2E3d">
<br>
}<br>
};<br>
<br>
The point can be moved within the map, and the commented alert also gets executed. However when I refresh the page<br>
the point is still at the initial location.<br>
<br>
Anything I am missing ?<br>
<br>
Thanks in advance,<br>
Indika<br>
<br>
<br>
<br></div>
2008/7/18 Indika Tantrigoda <<a href="mailto:indika85@gmail.com" target="_blank">indika85@gmail.com</a> <mailto:<a href="mailto:indika85@gmail.com" target="_blank">indika85@gmail.com</a>>><div class="Ih2E3d">
<br>
<br>
Thanks guys, appreciate this very much.<br>
<br>
Regards,<br>
Indika<br>
<br>
2008/7/17 Fabio D'Ovidio <<a href="mailto:fabiodovidio@gmail.com" target="_blank">fabiodovidio@gmail.com</a><br></div>
<mailto:<a href="mailto:fabiodovidio@gmail.com" target="_blank">fabiodovidio@gmail.com</a>>>:<div><div></div><div class="Wj3C7c"><br>
<br>
Here are samples using WFS-T and GeoServer.<br>
You can draw, modify and delete features (e.g. lines).<br>
I developed it for points, polygons, too and I have added<br>
FILTER on WFS requests passing a value in query string,<br>
configured also WMS GetFeatureInfo in order to query my WFS<br>
data on click.<br>
Now I am developing a module to create dinamically GeoRSS<br>
(including GML as geometries) by querying these features in<br>
geoserver as WFS Service and fill them with different colours<br>
respect some attribute values..<br>
<br>
Hope this help!<br>
<br>
map = new OpenLayers.Map( 'map' ,<br>
{ controls: [] , 'numZoomLevels':19});<br>
ol_wms = new OpenLayers.Layer.WMS(<br>
"OpenLayers WMS",<br>
"<a href="http://labs.metacarta.com/wms/vmap0" target="_blank">http://labs.metacarta.com/wms/vmap0</a>?", {layers:<br>
'basic'}<br>
);<br>
<br>
var linea = new OpenLayers.Layer.WFS(<br>
"Elementi lineari",<br>
"/geoserver/wfs",<br>
{typename: 'topp:linea'},<br>
{<br>
typename: 'linea',<br>
featureNS: '<a href="http://www.openplans.org/topp" target="_blank">http://www.openplans.org/topp</a>',<br>
extractAttributes: false<br>
}<br>
);<br>
if (!linea.writer) {<br>
poligono.writer = new<br>
OpenLayers.Format.WFS({layerName:'topp:linea'},linea);<br>
}<br>
linea.style.strokeColor<br>
= "#0000ff";<br>
<br>
map.addLayers([ol_wms, linea]);<br>
<br>
<br>
var panel = new OpenLayers.Control.Panel(<br>
{displayClass: 'olControlEditingToolbar'}<br>
);<br>
var drawLine = new OpenLayers.Control.DrawFeature(<br>
linea, OpenLayers.Handler.Path,<br>
{displayClass: 'olControlDrawFeaturePath'}<br>
);<br>
drawLine.featureAdded = function(feature) {<br>
feature.layer.eraseFeatures([feature]);<br>
// cast to multilinestring<br>
feature.geometry = new<br>
OpenLayers.Geometry.MultiLineString(<br>
feature.geometry<br>
);<br>
feature.style.strokeColor = "#ff0000";<br>
feature.style.strokeWidth = "5";<br>
feature.style.strokeOpacity = "0.75";<br>
feature.state = OpenLayers.State.INSERT;<br>
feature.layer.drawFeature(feature);<br>
}<br>
<br>
var modifyOptions = {<br>
onModificationStart: function(feature) {<br>
OpenLayers.Console.log("start modifying",<br></div></div>
<a href="http://feature.id" target="_blank">feature.id</a> <<a href="http://feature.id" target="_blank">http://feature.id</a>>);<div class="Ih2E3d"><br>
},<br>
onModification: function(feature) {<br>
OpenLayers.Console.log("modified", <a href="http://feature.id" target="_blank">feature.id</a><br></div>
<<a href="http://feature.id" target="_blank">http://feature.id</a>>);<div class="Ih2E3d"><br>
},<br>
onModificationEnd: function(feature) {<br>
OpenLayers.Console.log("end modifying",<br></div>
<a href="http://feature.id" target="_blank">feature.id</a> <<a href="http://feature.id" target="_blank">http://feature.id</a>>);<div class="Ih2E3d"><br>
<br>
feature.state =<br>
OpenLayers.State.UPDATE;<br>
},<br>
onDelete: function(feature) {<br>
OpenLayers.Console.log("delete", <a href="http://feature.id" target="_blank">feature.id</a><br></div>
<<a href="http://feature.id" target="_blank">http://feature.id</a>>); },<div class="Ih2E3d"><br>
onSelect: function(feature){<br>
OpenLayers.Console.log("select", <a href="http://feature.id" target="_blank">feature.id</a><br></div>
<<a href="http://feature.id" target="_blank">http://feature.id</a>>); feature.state = OpenLayers.State.DELETE;<div><div></div><div class="Wj3C7c"><br>
}<br>
};<br>
controls = {<br>
dellin: new<br>
OpenLayers.Control.SelectFeature(linea,<br>
modifyOptions),<br>
modifylin: new<br>
OpenLayers.Control.ModifyFeature(linea,<br>
modifyOptions)<br>
};<br>
for(var key in controls) {<br>
map.addControl(controls[key]);<br>
}<br>
document.getElementById('noneToggle').checked = true;<br>
panel.addControls(<br>
[new OpenLayers.Control.Navigation(), drawLine]<br>
);<br>
map.addControl(panel);<br>
map.addControl(new OpenLayers.Control.LayerSwitcher());<br>
map.addControl(new OpenLayers.Control.MouseDefaults());<br>
map.addControl(new<br>
OpenLayers.Control.MousePosition());<br>
map.addControl(new OpenLayers.Control.PanZoomBar());<br>
map.zoomToExtent();<br>
}<br>
function toggleControl(element) {<br>
for(key in controls) {<br>
var control = controls[key];<br>
if(element.value == key && element.checked) {<br>
control.activate();<br>
} else {<br>
control.deactivate();<br>
<br>
}<br>
}<br>
}<br>
<br>
-- Ing. Fabio D'Ovidio<br>
<br>
INOVA Open Solutions s.r.l.<br>
Web : <a href="http://www.inovaos.it" target="_blank">http://www.inovaos.it</a><br>
Tel.: 081 197 57 600<br></div></div>
mail: <a href="mailto:fabiodovidio@gmail.com" target="_blank">fabiodovidio@gmail.com</a> <mailto:<a href="mailto:fabiodovidio@gmail.com" target="_blank">fabiodovidio@gmail.com</a>><div class="Ih2E3d"><br>
<br>
<br>
Alexandre Dubé ha scritto:<br>
<br>
Hi Fabio,<br>
<br>
That would be most appreciated. Indika is also looking<br>
forward to see an example to get wfs-t features working.<br>
<br>
<br>
Fabio D'Ovidio wrote:<br>
<br>
If u want,<br>
I developed something like taht some times ago ...<br>
<br>
Alexandre Dubé ha scritto:<br>
<br>
Hi everyone,<br>
<br>
Does anybody have a WFS-T example to share ? I<br>
would like to see how to use a WFS layer, modify<br>
it and post my changes to a WFS server.<br>
<br>
Thanks,<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</div></blockquote>
<br><div><div></div><div class="Wj3C7c">
<br>
-- <br>
Alexandre Dubé<br>
Mapgears<br>
<a href="http://www.mapgears.com" target="_blank">www.mapgears.com</a><br>
<br>
</div></div></blockquote></div><br>