2

I'm facing a strange issue with GeoServer (2.4) (on PostgreSQL 9.4/PostGIS 2.1).

The problem is I am not able to insert a feature via WFS-T if the layer is empty; it returns me the following error:

<ows:ExceptionReport
    xmlns:ows="http://www.opengis.net/ows"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows http://0.0.0.0:8080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd">
    <ows:Exception exceptionCode="InvalidParameterValue">
        <ows:ExceptionText>Error performing insert: Error inserting features</ows:ExceptionText>
    </ows:Exception>
</ows:ExceptionReport>

The same WFS-T request works if the layer already has at least one feature.

I also have to note that I'm working with layers based on PostgreSQL updatable views (and I cannot do in another way) using the gt_pk_metadata_table table as reference for PKs.

This is some testing I did:

  • created new layer based on the view
  • tried WFS insert transaction (doesn't work)
  • inserted a feature directly to PostGIS via QGIS (result: the layer has exactly 1 feature)
  • tried WFS insert transaction (still doesn't work)
  • in "Edit Layer" page I clicked "Reload feature type"
  • tried WFS insert transaction (NOW IT WORKS) (result: has exactly 2 features)
  • removed all features (2) directly via PostGIS (pgAdmin) (result: 0 features)
  • tried WFS insert transaction (IT STILL WORKS) (result: 1 feature)
  • in "Edit Layer" page I clicked "Reload feature type"
  • tried WFS insert transaction (DOESN'T WORK ANY MORE)

During the testing I started a GIT repository in the data_dir to check for file changes but NO file was changed!

I have the feeling it has something to do with new PKs in the updatable view but could be completely wrong.

Can anybody help me figure out what the problem is?

Update:

I changed the logging level to GEOTOOLS_DEVELOPER_LOGGING, as suggested by @user30184, and it looks like the error is due to un-matching srid:

ERROR: new row for relation "table_name" violates check constraint "enforce_srid_the_geom"

I should also note that the WFS-T request is started by OpenLayers using a different projection from the one used in the PostGIS table (EPSG:900913 -> EPSG:3045).

I guess the origin of the problem could be in the fact the layer is based on a PostgreSQL updatable view, which is empty when the layer is empty and I think GeoServer isn't able to figure out the srid of the view thus generating a PostGIS query based on the request srid. Then when the updatable view actually tries to write the record PostGIS realizes the srids aren't matching and fails.

Could this be the reason for the problem? Any suggestion on how to solve this?

  • 2
    Change logging level into "geotools developer" and you should get all the SQL that it sent to PostGIS into log and you can study the requests and send them manually from psql. Perhaps you can get good error messages from PostGIS that way. – user30184 Jun 23 '14 at 4:32
  • Tnx @user30184 ! I integrated the question with some more details also derived by some testing done following your suggestion. But I'm still looking for a solution. – mettjus Jun 23 '14 at 16:00
  • I have the same problem. The xml is: <wfs:Insert> <parcela_mr_poligonos xmlns="rosario.gob.ar"> <id xmlns="rosario.gob.ar">263882</id> <geometria xmlns="rosario.gob.ar"> <gml:Polygon srsName="EPSG:22185"> <gml:exterior> <gml:LinearRing> <gml:posList>5435990.024 6351367.694 5435991.338 6351374.06 5436005.078 6351371.24 5436003.763 6351364.87 5435990.024 6351367.694</gml:posList> </gml:LinearRing> </gml:exterior> </gml:Polygon> </geometria> <catastral xmlns="rosario.gob.ar">12099035</catastral> <id_informix xmlns="rosario.gob.ar">50 – joluinfante May 24 at 1:06

Your Answer

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

Browse other questions tagged or ask your own question.