<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
In order to get WFS Delete to work I changed OpenLayers/Format/WFS.js.<br>
For some reasen in the remove section other properties are used as with
Update and Insert:<br>
feature.attribures.fid &lt;-&gt; feature.fid<br>
this.featureNS &lt;-&gt; this.wfsns<br>
I changed these things and after that a feature was really deleted from
the database!<br>
Probably the same result is achieved if you set these properties in
your own script, but for me the test was whether it could work and than
what would happen.<br>
Actually I was looking for a way to delete only the geometry or empty
the geometry but can't get that to work yet, because in my situation
other attributes than geometry have to be kept in the database.<br>
<br>
Below the original line after // and below that my correction in
OpenLayers/Format/WFS.js:<br>
&nbsp;&nbsp;&nbsp; remove: function(feature) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //if (!feature.attributes.fid) { <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!feature.fid) { <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alert("Can't update a feature for which there is no FID.");
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return false; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //var deleteNode = document.createElementNS(this.featureNS,
'wfs:Delete');<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var deleteNode = document.createElementNS(this.wfsns,
'wfs:Delete');<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; deleteNode.setAttribute("typeName", this.layerName);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var filterNode =
document.createElementNS('<a class="moz-txt-link-freetext" href="http://www.opengis.net/ogc">http://www.opengis.net/ogc</a>', 'ogc:Filter');<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var filterIdNode =
document.createElementNS('<a class="moz-txt-link-freetext" href="http://www.opengis.net/ogc">http://www.opengis.net/ogc</a>', 'ogc:FeatureId');<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //filterIdNode.setAttribute("fid", feature.attributes.fid);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; filterIdNode.setAttribute("fid", feature.fid);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; filterNode.appendChild(filterIdNode);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; deleteNode.appendChild(filterNode);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return deleteNode;<br>
&nbsp;&nbsp;&nbsp; },<br>
<br>
<pre class="moz-signature" cols="80">Rinke Heida</pre>
<br>
Arnaud Cogoluegnes wrote:
<blockquote cite="mid:006301c85840$339679f0$10aa210a@SQLI50624"
 type="cite">
  <pre wrap="">I finally found a hack (well, I think it is) by reading the
OpenLayers.Format.WFS.js code. Seems the typeName attribute of the update
request is mapped with the OpenLayers.Format.WFS layerName property.

The WFS layer writer (a OpenLayers.Format.WFS object) is created on demand
when the commit method is called:

/* from OpenLayers.Layer.WFS */
if (!this.writer) {
  this.writer = new OpenLayers.Format.WFS({},this);
}

The option table is empty, so the layerName property is not initialized. So
after the WFS layer creation, I added:

if (!water.writer) {
  water.writer = new
OpenLayers.Format.WFS({layerName:'G4WD:tasmania_water'},water);
}

I don&#8217;t know if it's the correct way, but it worked (I would be happy to
know the correct way if it exists :-)  )

If I find anything about the DELETE request (the FID was missing), I'll let
you know

Cheers

Arnaud

-----Message d'origine-----
De&nbsp;: <a class="moz-txt-link-abbreviated" href="mailto:users-bounces@openlayers.org">users-bounces@openlayers.org</a> [<a class="moz-txt-link-freetext" href="mailto:users-bounces@openlayers.org">mailto:users-bounces@openlayers.org</a>] De
la part de Pierre GIRAUD
Envoy&eacute;&nbsp;: mercredi 16 janvier 2008 11:49
&Agrave;&nbsp;: Yingqi
Cc&nbsp;: <a class="moz-txt-link-abbreviated" href="mailto:users@openlayers.org">users@openlayers.org</a>
Objet&nbsp;: Re: [OpenLayers-Users] WFS-T delete/update

Hi Arnaud,

I didn't use the WFS-T functionnalities for a long time now. I hope I
can throw an eye on it, but I don't think I will have time soon.
However, don't hesitate to send snippets of code so that I can
reproduce your test case.

Regards,
Pierre

On Jan 16, 2008 9:06 AM, Yingqi <a class="moz-txt-link-rfc2396E" href="mailto:anakintang@gmail.com">&lt;anakintang@gmail.com&gt;</a> wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">I think you should probably dig into OpenLayers\Format\GML.js to see if
    </pre>
  </blockquote>
  <pre wrap=""><!---->fid
  </pre>
  <blockquote type="cite">
    <pre wrap="">is correctly retrieved when GML response from Geoserver was parsed when
    </pre>
  </blockquote>
  <pre wrap=""><!---->you
  </pre>
  <blockquote type="cite">
    <pre wrap="">turned the layer. I guess fid attribute in your features are empty.



Arno wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">Hi all,

I've been trying the WFS-T support for inserting polygons and it works
greats (polygons added in the PostGIS database, using GeoServer 1.6). I
tried also modifying features with the ModifyFeature Controls (based on
the
online example). Using the modifyOptions, I changed the state of the
feature:

feature.state = OpenLayers.State.UPDATE;

and then tried to commit the WFS layer. But I received an error from the
GeoServer (log traces something like "features is not available") and
      </pre>
    </blockquote>
  </blockquote>
  <pre wrap=""><!---->the
  </pre>
  <blockquote type="cite">
    <blockquote type="cite">
      <pre wrap="">transaction failed. Before asking something on the GeoServer list, is
there
anything I missed when trying to modify the feature with OpenLayers?

For deleting, I used the SelectFeature control, overrode the onSelect
method
to mark the feature as deleted:

feature.state = OpenLayers.State.DELETE;

and when committing the WFS layer, OpenLayers displayed a message saying
that the fid was missing. Same as the update question, is there anything
      </pre>
    </blockquote>
  </blockquote>
  <pre wrap=""><!---->I
  </pre>
  <blockquote type="cite">
    <blockquote type="cite">
      <pre wrap="">missed when trying to mark the feature?

Thanks!

Arnaud

_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@openlayers.org">Users@openlayers.org</a>
<a class="moz-txt-link-freetext" href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</a>


      </pre>
    </blockquote>
    <pre wrap="">--
View this message in context:
    </pre>
  </blockquote>
  <pre wrap=""><!----><a class="moz-txt-link-freetext" href="http://www.nabble.com/WFS-T-delete-update-tp14843989p14873181.html">http://www.nabble.com/WFS-T-delete-update-tp14843989p14873181.html</a>
  </pre>
  <blockquote type="cite">
    <pre wrap="">Sent from the OpenLayers Users mailing list archive at Nabble.com.


_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@openlayers.org">Users@openlayers.org</a>
<a class="moz-txt-link-freetext" href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</a>

    </pre>
  </blockquote>
  <pre wrap=""><!---->_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@openlayers.org">Users@openlayers.org</a>
<a class="moz-txt-link-freetext" href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</a>



_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@openlayers.org">Users@openlayers.org</a>
<a class="moz-txt-link-freetext" href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</a>


  </pre>
</blockquote>
</body>
</html>