Dear list,
Like others have been struggling with also, I am trying to get some
PostGIS-views to get to work (that is: write through GeoServer/WFS-T).
Through SQL, this VIEW has been made writeable by the use of RULEs; with
some INSERTs and UPDATEs this has been tested.
The view is defined as follows:
CREATE VIEW vw_dum AS SELECT * FROM cp_dum;
CREATE OR REPLACE RULE ins_cp_dum AS
ON INSERT TO vw_dum DO INSTEAD INSERT INTO cp_dum (geom, category)
SELECT new.geom, new.category;
CREATE OR REPLACE RULE upd_cp_dum AS
ON UPDATE TO vw_dum DO INSTEAD UPDATE cp_dum SET geom = new.geom,
category = new.category
WHERE cp_dum.id = new.id;
The table behind that view is defined such:
CREATE TABLE cp_dum (id SERIAL PRIMARY KEY, geom GEOMETRY, category
INTEGER);
The VIEW has been added to PostGIS' geometry_columns metadata table:
INSERT INTO geometry_columns(f_table_catalog, f_table_schema, f_table_name,
f_geometry_column, coord_dimension, srid, "type") VALUES('', 'public',
'vw_dum', 'geom', 2, 28992, 'POLYGON');
Some polygons have been inserted into the cp_dum table. The VIEW is not of
much use, you would say; it's merely for testing purposes...
Then I created the following table:
CREATE TABLE gt_pk_metadata_table (
table_schema VARCHAR(32) NOT NULL,
table_name VARCHAR(32) NOT NULL,
pk_column VARCHAR(32) NOT NULL,
pk_column_idx INTEGER,
pk_policy VARCHAR(32),
pk_sequence VARCHAR(64),
unique (table_schema, table_name, pk_column),
check (pk_policy in ('sequence', 'assigned', 'autoincrement'))
);
Within the GeoServer webconfig I created a PostGIS Vector Data Store
refering to this metadata table (it is called the "Primary key metadata
table").
The following record is expected to have GeoServer treating the VIEW's id
column as PK:
INSERT INTO gt_pk_metadata_table VALUES('public', 'vw_dum', 'id', NULL,
'assigned', NULL);
The new layer is added to GeoServer. (GeoServer's output to console suggests
that nothing is wrong and the PK is applied [before, without the
gt_pk_metadata table entrie, I got warnings about missing PK) When accessed
through WFS, a nice map is shown in my desktop GIS client (MapInfo).
However, when updating the dataset with MapInfo through WFS-T, a
WFSTransactionException is thrown by GeoServer: "vw_dum is read-only".
Any idea's? Your help is very much appreciated.
I am running GeoServer 2.0.2
Regards,
Rob
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users