I try to implement insertion of new point using Openlayers v2.13 saveStrategy calling tinyows which implements the WFS-T transaction; I use the example from http://mapserver.org/tinyows/openlayershowto.html - the code is exactly the same except for the layer.

I have two questions:

1) adding a new point implements a transaction which uses "MULTIPOINT" but my postgis layer is of type POINT - is there a way to force "POINT" ? My solution up to now is to use a TRIGGER in postgresql to do an INSTEAD OF to change MULTIPOINT TO POINT.

2) I get an error because the insertion creates a "gid" value which should not be included, as it is added by default by the counter. The TINYOWS log give me the following transaction and error:


INSERT INTO "arch_geo_dbt"."p030104_v" ("gid","the_geom") VALUES ('042159162153000033','010400002031BF0D00010000000101000000B69CF08B3069314130B8664669AD5541')


ERROR: value "042159162153000033" is out of range for type integer

Below my XML from the REQUEST POST

<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"><wfs:Insert><feature:dbtcivici xmlns:feature="http://www.tinyows.org/"><feature:the_geom><gml:MultiPoint xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:900913"><gml:pointMember><gml:Point><gml:pos>1141040.5466402 5682597.1000195</gml:pos></gml:Point></gml:pointMember></gml:MultiPoint></feature:the_geom></feature:dbtcivici></wfs:Insert></wfs:Transaction>

Does anyone know how to solve this problem?

closed as too broad by PolyGeo Nov 13 '18 at 11:55

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


The point was that tinyows (version 1.0.0) when adding a new feature when getting a "insert" transaction request, adds a random string as GID. Now GID is either an integer or a biginteger, and defaults to NEXTVAL(sequence) in the Postgres/Postgis table. The GID that tinyows created was too big (out of range).

Tinyows works fine with a table, but the table I was trying to update was a VIEW (of course I was using triggers to update the tables behind the views, as views are not updateble). Tinyows allows to set pkey="gid" in the layer object in its config.xml file, nevertheless if it is a view it probably does not understand the type (i.e. integer).

MY SOLUTION: in the view, CAST the GID column to text type, so the insert does not throw an error, and then in the triggers forget the GID value created by tinyows, and use the correct NEXTVAL().

If anyone is interested I can post my trigger routine.

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