[Geoserver-users] Relations between features with WFS and PostGIS

Hello everyone,

I am trying to use GeoServer 1.4 with PostGIS to store features that may have
a geometric value (optional!) and also relations to other features. I would
like to insert and query these features using WFS 1.0.0. Playing around a bit
I encountered several issues.

What is the best or standard way to realise (many-to-many) relations? First, I
created a simple feature table in Postgres/PostGIS with a foreign key to
itself:

CREATE TABLE some_places (
  pid integer PRIMARY KEY,
  place_name character varying(128) NOT NULL,
  refers_to integer REFERENCES places
);
SELECT AddGeometryColumn (...,'place_geom',...);

Afterwards, I can easily define a new FeatureType within GeoServer. The
refers_to element is treated as a usual int attribute of the feature but
actually representing the id of the referenced feature. So I am able to follow
relations querying this feature id. However, I did not find a way to introduce
a many-to-many relationship because I need an additional table wich is not
referenced by the feature table directly.

I also found nice mechanisms in the GML simple profile spec where you can
define the feature type of the reference target. Is there a similar approach
in the WFS?

My second problem is that I cannot insert a place without a place_geom value
although the schema and the table definition allow this. As workaround I am
currently using a constant polygon with 0.0 values but I am not so happy about
it.

I would appreciate any hints and also references to docs that might help.

Thank you in advance!

Regards,
Martin

This message has already been answered
http://www.nabble.com/Relations-between-features-with-WFS-and-PostGIS-tf2971393.html#a8316829
here .

Apologies for duplicate email! I had problems sending to a SourceForge
mailinglist with another email account.

Regards,
martin

Martin Gruhn wrote:

Hello everyone,

I am trying to use GeoServer 1.4 with PostGIS to store features that may
have
a geometric value (optional!) and also relations to other features. I
would
like to insert and query these features using WFS 1.0.0. Playing around a
bit
I encountered several issues.

What is the best or standard way to realise (many-to-many) relations?
First, I
created a simple feature table in Postgres/PostGIS with a foreign key to
itself:

CREATE TABLE some_places (
  pid integer PRIMARY KEY,
  place_name character varying(128) NOT NULL,
  refers_to integer REFERENCES places
);
SELECT AddGeometryColumn (...,'place_geom',...);

Afterwards, I can easily define a new FeatureType within GeoServer. The
refers_to element is treated as a usual int attribute of the feature but
actually representing the id of the referenced feature. So I am able to
follow
relations querying this feature id. However, I did not find a way to
introduce
a many-to-many relationship because I need an additional table wich is not
referenced by the feature table directly.

I also found nice mechanisms in the GML simple profile spec where you can
define the feature type of the reference target. Is there a similar
approach
in the WFS?

My second problem is that I cannot insert a place without a place_geom
value
although the schema and the table definition allow this. As workaround I
am
currently using a constant polygon with 0.0 values but I am not so happy
about
it.

I would appreciate any hints and also references to docs that might help.

Thank you in advance!

Regards,
Martin

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
View this message in context: http://www.nabble.com/Relations-between-features-with-WFS-and-PostGIS-tf3015450.html#a8387567
Sent from the GeoServer - User mailing list archive at Nabble.com.