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. Playing around a
bit I encountered several questions (more detailed explanations below):
1. What is the best or standard way to define and query relations between
features?
2. Can I insert a new feature (with WFS insert) without a geometry?
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 based on
the database definitions. The refers_to element is treated as a regular int
attribute of the feature, and actually representing the id of the referenced
feature. So I am able to follow relations querying this feature id.
However, a many-to-many relationship seems impossible because I cannot span
a feature over several tables (as discussed in the 'Feature over more the on
table' thread recently).
I also found nice mechanisms in the GML simple profile spec where you can
define the feature type of the reference target. I don't think there is a
similar approach using WFS, is it?
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 guess GeoServer simply expects a geometry, tries to handle it
and consequently throws a nullpointer.
I digged through some docs and specs already but could not find the desired
information. So I would appreciate any comments or references to helpful
documents.
Thank you in advance!
Regards,
Martin
--
View this message in context: http://www.nabble.com/Relations-between-features-with-WFS-and-PostGIS-tf2971393.html#a8314570
Sent from the GeoServer - User mailing list archive at Nabble.com.