2

I have a webapp - OpenLayers<->tinyows<->postgis. With 1 layer I have a problem.

On localhost all works well - here is a snip of the XML I get back:

 <gml:featureMember>
   <tows:trad gml:id="trad.34">
   <tows:geom><gml:Point srsName="EPSG:4326"><gml:pos>12.01865 57.666245</gml:pos></gml:Point></tows:geom>
   etc...

but on my web server, the XML I get back is:

 <gml:featureMember>
   <tows:trad>
   <tows:ogc_fid>34</tows:ogc_fid>
   <tows:geom><gml:Point srsName="EPSG:4326"><gml:pos>12.01865   57.666245</gml:pos></gml:Point></tows:geom>
   etc...

The layer displays fine, but this quirk means that I am unable to edit the layer:

tinyows error: [Tue Mar 18 16:33:07 2014] [ERROR] Element '{http://www.opengis.net/ogc}FeatureId': The attribute 'fid' is required but missing.

/etc/tinyows.xml:

<tinyows online_resource="http://localhost/cgi-bin/tinyows"
     schema_dir="/usr/share/tinyows/schema/"
     log="/var/log/tinyows.log"
     log_level="15" >

<pg host="localhost" user="postgres" password="xxxx" dbname="test" port="5432"/>

<metadata name="TinyOWS Server"
       title="treeMapp TinyOWS Server - Service" />

<layer retrievable="1"
    writable="1"
    ns_prefix="tows"
    ns_uri="http://www.tinyows.org/"
    name="trad"
    table="trad"
    title="Träd" />

<layer retrievable="1"
    writable="1"
    ns_prefix="tows"
    ns_uri="http://www.tinyows.org/"
    name="tradtest"
    table="tradtest"
    title="Träd test" />

</tinyows>

Other layers on the same set up on the web server work fine.

  • Check if the table in the webserver have the same definition (check if it has a primary key defined) – Tommaso Mar 18 '14 at 21:04
  • Yep - the table's a copy of the localhost, has a primary key on ogc_fid which is a sequence, the table was created with ogr2ogr. – minisaurus Mar 20 '14 at 16:35
  • Just edited - added /etc/tinyows.xml – minisaurus Mar 20 '14 at 16:41
1

It seems that the 2 xml have a different version of the GML:

This seems GMLv3.1

<gml:featureMember>
   <tows:trad gml:id="trad.34">  <!-- gml:id -->
   <tows:geom><gml:Point srsName="EPSG:4326"><gml:pos>12.01865 57.666245</gml:pos>        </gml:Point></tows:geom>
   etc...

This seems GMLv2

<gml:featureMember>
   <tows:trad>
   <tows:ogc_fid>34</tows:ogc_fid>
   <tows:geom><gml:Point srsName="EPSG:4326"><gml:pos>12.01865   57.666245</gml:pos>    </gml:Point></tows:geom>
   etc...

Maybe the two server have different versions? The last xml-snippet suggest that the server is not able to recognize the primary key for the layer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.