[Geoserver-devel] Update geometry

I am configuring a database (Postgis on windows) to store GPS coordinates.
I want to update the geometry for the points in real time (well at least as
close to as possible). I am trying to figure out the XML necessary to
perform such an operation through WFS. I have come up with two possible
approaches:

1. Use Update statement with geometry column. Does this work?. If so, I
don't know how to write such an expression, if anyone can help me out here
it would be great.

2. Use Delete and Insert statements within a Transaction. I have tried the
following:

<wfs:Transaction service="WFS" handle="Transaction 01" version="1.0.0"
  xmlns:cdf="http://www.opengis.net/cite/data&quot;
  xmlns:ogc="http://www.opengis.net/ogc&quot;
  xmlns:wfs="http://www.opengis.net/wfs&quot;&gt;
  <wfs:Delete typeName="topp:posiciones">
    <ogc:Filter>
      <ogc:PropertyIsEqualTo>
        <ogc:PropertyName>topp:objectid</ogc:PropertyName>
        <ogc:Literal>1</ogc:Literal>
      </ogc:PropertyIsEqualTo>
    </ogc:Filter>
  </wfs:Delete>
  <wfs:Insert handle="Statement 1">
    <topp:posiciones>
      <topp:the_geom>
        <gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#23030&quot;&gt;
               <gml:coordinates decimal="." cs="," ts=" ">430000,4650000
</gml:coordinates>
          </gml:Point>
      </topp:the_geom>
      <topp:objectid>1</topp:objectid>
      <topp:ict_id_dev>1</topp:ict_id_dev>
      <topp:ict_fc_dat>15/09/2004</topp:ict_fc_dat>
      <topp:ict_x_coor>430000</topp:ict_y_coor>
      <topp:ict_y_coor>4650000</topp:ict_y_coor>
    </topp:posiciones>
  </wfs:Insert>
</wfs:Transaction>

If I do Delete and Insert in separate transactions they work but I want
both commands to be in one transaction to ensure data integrity.

But I get the following error:

<?xml version="1.0" ?>
<ServiceExceptionReport
   version="1.2.0"
   xmlns="http://www.opengis.net/ogc&quot;
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
   xsi:schemaLocation="http://www.opengis.net/ogc
http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd&quot;&gt;
   <ServiceException
locator="org.vfny.geoserver.requests.readers.DispatcherXmlReader">
      XML get capabilities request parsing error:
org.xml.sax.SAXParseException: The prefix &quot;topp&quot; for element
&quot;topp:posiciones&quot; is not bound. </ServiceException>
</ServiceExceptionReport>

What am I doing wrong?.

Thank you very much in advance.

Juan Marín Otero
TRAGSATEC S.A.
Departamento de Cartografía
Tlf. 91 322 64 98

Este correo es sólo informativo y por lo tanto no supone obligación
contractual para TRAGSATEC ni para las sociedades a ella vinculadas. La
información incluida en el presente correo electrónico es CONFIDENCIAL,
siendo para el uso exclusivo del destinatario arriba mencionado. Si usted
lee este mensaje y no es el destinatario señalado, el empleado o el agente
responsable de entregar el mensaje al destinatario, o ha recibido esta
comunicación por error, le informamos que está totalmente prohibido
cualquier almacenamiento, divulgación, distribución o reproducción de esta
comunicación y de los archivos que pueda contener. Le rogamos que nos lo
notifique, devuelva el original al emisor del correo y destruya el mensaje.

El correo electrónico vía Internet no permite asegurar la confidencialidad
de los mensajes que se transmiten, ni su integridad o correcta recepción.
TRAGSATEC no asume responsabilidad por estas circunstancias. Si el
destinatario de este mensaje no consintiera la utilización del correo
electrónico vía Internet y la grabación de los mensajes, rogamos lo ponga
en nuestro conocimiento de forma inmediata.

Juan,

Delete + Insert:

I am not sure that geoserver follows the order you implied in the xml
transaction. Although this seems logical, geoserver passes an entire transaction
off to the database serving the data. There may also be a parsing issue (sorry
can't recall that parsing code off hand).

Update:

This is exactly what an update is. There is an example update included with the
instalation (don't have geoserver installed on this machine). Send me an email
if you can't find it.

As a side note, if you are accessing GeoServer programtically (which you
probably are) you should checkout my work in geotools. I just finished an alpha
WFS client, and have started in providing full transactional support to Web
Feature Servers. This code can be found at
http://svn.geotools.org/geotools/trunk/gt/plugins/wfs

Hope this helps,

David

Quoting Juan Marín Otero <jmo@anonymised.com>:

I am configuring a database (Postgis on windows) to store GPS coordinates.
I want to update the geometry for the points in real time (well at least as
close to as possible). I am trying to figure out the XML necessary to
perform such an operation through WFS. I have come up with two possible
approaches:

1. Use Update statement with geometry column. Does this work?. If so, I
don't know how to write such an expression, if anyone can help me out here
it would be great.

2. Use Delete and Insert statements within a Transaction. I have tried the
following:

<wfs:Transaction service="WFS" handle="Transaction 01" version="1.0.0"
  xmlns:cdf="http://www.opengis.net/cite/data&quot;
  xmlns:ogc="http://www.opengis.net/ogc&quot;
  xmlns:wfs="http://www.opengis.net/wfs&quot;&gt;
  <wfs:Delete typeName="topp:posiciones">
    <ogc:Filter>
      <ogc:PropertyIsEqualTo>
        <ogc:PropertyName>topp:objectid</ogc:PropertyName>
        <ogc:Literal>1</ogc:Literal>
      </ogc:PropertyIsEqualTo>
    </ogc:Filter>
  </wfs:Delete>
  <wfs:Insert handle="Statement 1">
    <topp:posiciones>
      <topp:the_geom>
        <gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#23030&quot;&gt;
               <gml:coordinates decimal="." cs="," ts=" ">430000,4650000
</gml:coordinates>
          </gml:Point>
      </topp:the_geom>
      <topp:objectid>1</topp:objectid>
      <topp:ict_id_dev>1</topp:ict_id_dev>
      <topp:ict_fc_dat>15/09/2004</topp:ict_fc_dat>
      <topp:ict_x_coor>430000</topp:ict_y_coor>
      <topp:ict_y_coor>4650000</topp:ict_y_coor>
    </topp:posiciones>
  </wfs:Insert>
</wfs:Transaction>

If I do Delete and Insert in separate transactions they work but I want
both commands to be in one transaction to ensure data integrity.

But I get the following error:

<?xml version="1.0" ?>
<ServiceExceptionReport
   version="1.2.0"
   xmlns="http://www.opengis.net/ogc&quot;
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
   xsi:schemaLocation="http://www.opengis.net/ogc
http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd&quot;&gt;
   <ServiceException
locator="org.vfny.geoserver.requests.readers.DispatcherXmlReader">
      XML get capabilities request parsing error:
org.xml.sax.SAXParseException: The prefix &quot;topp&quot; for element
&quot;topp:posiciones&quot; is not bound. </ServiceException>
</ServiceExceptionReport>

What am I doing wrong?.

Thank you very much in advance.

Juan Marín Otero
TRAGSATEC S.A.
Departamento de Cartografía
Tlf. 91 322 64 98

Este correo es sólo informativo y por lo tanto no supone obligación
contractual para TRAGSATEC ni para las sociedades a ella vinculadas. La
información incluida en el presente correo electrónico es CONFIDENCIAL,
siendo para el uso exclusivo del destinatario arriba mencionado. Si usted
lee este mensaje y no es el destinatario señalado, el empleado o el agente
responsable de entregar el mensaje al destinatario, o ha recibido esta
comunicación por error, le informamos que está totalmente prohibido
cualquier almacenamiento, divulgación, distribución o reproducción de esta
comunicación y de los archivos que pueda contener. Le rogamos que nos lo
notifique, devuelva el original al emisor del correo y destruya el mensaje.

El correo electrónico vía Internet no permite asegurar la confidencialidad
de los mensajes que se transmiten, ni su integridad o correcta recepción.
TRAGSATEC no asume responsabilidad por estas circunstancias. Si el
destinatario de este mensaje no consintiera la utilización del correo
electrónico vía Internet y la grabación de los mensajes, rogamos lo ponga
en nuestro conocimiento de forma inmediata.

-------------------------------------------------------
This SF.Net email is sponsored by: thawte's Crypto Challenge Vl
Crack the code and win a Sony DCRHC40 MiniDV Digital Handycam
Camcorder. More prizes in the weekly Lunch Hour Challenge.
Sign up NOW http://ad.doubleclick.net/clk;10740251;10262165;m
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Hi,

    You need to bind your namespace. Put a line like this

    xmlns:topp="http://yourserver/topp&quot;

    as an attribute in your <wfs:Transaction> tag.

    This update request works fine here:

<?xml version="1.0" ?>
<wfs:Transaction
    version="1.0.0"
    service="WFS"
    xmlns:prototipo="http://localhost/prototipo-gis/prototipo-gis&quot;
    xmlns:gml="http://www.opengis.net/gml&quot;
    xmlns:wfs="http://www.opengis.net/wfs&quot;
    xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
  <wfs:Update typeName="prototipo:acervo_espacial">
    <wfs:Property>
      <wfs:Name>prototipo:descricao</wfs:Name>
      <wfs:Value>new test</wfs:Value>
    </wfs:Property>
    <ogc:Filter>
      <ogc:PropertyIsEqualTo>
        <ogc:PropertyName>prototipo:descricao</ogc:PropertyName>
        <ogc:Literal>test</ogc:Literal>
      </ogc:PropertyIsEqualTo>
    </ogc:Filter>
  </wfs:Update>
</wfs:Transaction>

-- Alexandre

Em Wed, 15 Sep 2004 12:33:47 +0200
Juan Marín Otero <jmo@anonymised.com> escreveu:

I am configuring a database (Postgis on windows) to store GPS coordinates.
I want to update the geometry for the points in real time (well at least as
close to as possible). I am trying to figure out the XML necessary to
perform such an operation through WFS. I have come up with two possible
approaches:

1. Use Update statement with geometry column. Does this work?. If so, I
don't know how to write such an expression, if anyone can help me out here
it would be great.

2. Use Delete and Insert statements within a Transaction. I have tried the
following:

<wfs:Transaction service="WFS" handle="Transaction 01" version="1.0.0"
  xmlns:cdf="http://www.opengis.net/cite/data&quot;
  xmlns:ogc="http://www.opengis.net/ogc&quot;
  xmlns:wfs="http://www.opengis.net/wfs&quot;&gt;
  <wfs:Delete typeName="topp:posiciones">
    <ogc:Filter>
      <ogc:PropertyIsEqualTo>
        <ogc:PropertyName>topp:objectid</ogc:PropertyName>
        <ogc:Literal>1</ogc:Literal>
      </ogc:PropertyIsEqualTo>
    </ogc:Filter>
  </wfs:Delete>
  <wfs:Insert handle="Statement 1">
    <topp:posiciones>
      <topp:the_geom>
        <gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#23030&quot;&gt;
               <gml:coordinates decimal="." cs="," ts=" ">430000,4650000
</gml:coordinates>
          </gml:Point>
      </topp:the_geom>
      <topp:objectid>1</topp:objectid>
      <topp:ict_id_dev>1</topp:ict_id_dev>
      <topp:ict_fc_dat>15/09/2004</topp:ict_fc_dat>
      <topp:ict_x_coor>430000</topp:ict_y_coor>
      <topp:ict_y_coor>4650000</topp:ict_y_coor>
    </topp:posiciones>
  </wfs:Insert>
</wfs:Transaction>

If I do Delete and Insert in separate transactions they work but I want
both commands to be in one transaction to ensure data integrity.

But I get the following error:

<?xml version="1.0" ?>
<ServiceExceptionReport
   version="1.2.0"
   xmlns="http://www.opengis.net/ogc&quot;
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
   xsi:schemaLocation="http://www.opengis.net/ogc
http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd&quot;&gt;
   <ServiceException
locator="org.vfny.geoserver.requests.readers.DispatcherXmlReader">
      XML get capabilities request parsing error:
org.xml.sax.SAXParseException: The prefix &quot;topp&quot; for element
&quot;topp:posiciones&quot; is not bound. </ServiceException>
</ServiceExceptionReport>

What am I doing wrong?.

Thank you very much in advance.

Juan Marín Otero
TRAGSATEC S.A.
Departamento de Cartografía
Tlf. 91 322 64 98