[Geoserver-users] About GML schema file and mapping attributes

Hello list.

I'm trying to creating a GML data model and I want to put it into GeoServer, backed by a PostGIS database.
My XML Schema file is as follow:

<xs:complexType name = "gmlfeature2_Type" >
<xs:complexContent>
  <xs:extension base = "gml:AbstractFeatureType" >
   <xs:sequence>
    <xs:element ref="gml:extentOf" minOccurs="1" maxOccurs="1"></xs:element>
   </xs:sequence>
  </xs:extension>
</xs:complexContent>
</xs:complexType>

As per GeoServer documentation, I put this text in a schema.xml file into the proper directory in the GeoServer installation (installed with the war file into Tomcat 5.5, linux box - version 1.3.2). I'm confident the info.xml is correct (I modified a generated one).
I can get a correct WFSDescribeFeatureType response from GeoServer.
I created the corresponding PostGIS table:

CREATE TABLE "public"."gmlfeature2" (
  "fid" VARCHAR NOT NULL,
  "name" VARCHAR,
  "description" VARCHAR,
  "boundedBy" "public"."geometry",
  "extentOf" "public"."geometry",
  CONSTRAINT "gmlfeature2_pkey" PRIMARY KEY("fid")
  [...] (I omitted spatial PostGIS constraints)
) WITHOUT OIDS;

I successfully loaded some features into the table with some SQL INSERT.

But when I query GeoServer (with a simple WFSGetFeature request), I get what seems to me a bad GML document. A single feature from the response is this (ddm is my own namespace's prefix):

<ddm:gmlfeature2 fid="gmlfeature2.0">
<ddm:name>MyName</ddm:name>
<ddm:description>MyDesc</ddm:description>
<ddm:extentOf>
  <gml:Polygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
   <gml:outerBoundaryIs>
    <gml:LinearRing>
     <gml:coordinates decimal="." cs="," ts=" ">-20,20 20,20 20,-20 -20,-20 -20,20</gml:coordinates>
    </gml:LinearRing>
   </gml:outerBoundaryIs>
  </gml:Polygon>
</ddm:extentOf>
</ddm:gmlfeature2>

I think it's bad because it puts every feature's attribute in my own namespace (ddm), but all those attributes (name, description) are from the standard GML 2 Schema, inherited from the base type AbstractFeatureType. extentOf is a GML-defined element, and as such it should be prefixed by "gml:", not by my own prefix "ddm:" (which doesn't define such element).

Am I right? Is there something I'm missing? Or this is a GeoServer behaviour and a GML data modeler *has* to design his/her data model with only custom attributes (all from the application namespace)?

Thanks in advance for any feedback.

Best regards,

Fabio Da Soghe

There's a hack to handle this. If you put this line in your catalog.xml file:

<citeConformanceHacks>true</citeConformanceHacks>

in the WFS sub section (within <service type = "WFS" enabled = "true" >, like the same level as serviceLevel, for example). Then it should prefix name, description and boundedBy with a gml prefix.

We haven't made it an option in the web admin tool since it's pretty hacky. In the future we hope to have a much better feature model which will give you a lot more control over such things.

best regards,

Chris

Fabio Da Soghe wrote:

Hello list.

I'm trying to creating a GML data model and I want to put it into GeoServer, backed by a PostGIS database.
My XML Schema file is as follow:

<xs:complexType name = "gmlfeature2_Type" >
<xs:complexContent>
  <xs:extension base = "gml:AbstractFeatureType" >
   <xs:sequence>
    <xs:element ref="gml:extentOf" minOccurs="1" maxOccurs="1"></xs:element>
   </xs:sequence>
  </xs:extension>
</xs:complexContent>
</xs:complexType>

As per GeoServer documentation, I put this text in a schema.xml file into the proper directory in the GeoServer installation (installed with the war file into Tomcat 5.5, linux box - version 1.3.2). I'm confident the info.xml is correct (I modified a generated one).
I can get a correct WFSDescribeFeatureType response from GeoServer.
I created the corresponding PostGIS table:

CREATE TABLE "public"."gmlfeature2" (
  "fid" VARCHAR NOT NULL, "name" VARCHAR, "description" VARCHAR, "boundedBy" "public"."geometry", "extentOf" "public"."geometry", CONSTRAINT "gmlfeature2_pkey" PRIMARY KEY("fid")
  [...] (I omitted spatial PostGIS constraints)
) WITHOUT OIDS;

I successfully loaded some features into the table with some SQL INSERT.

But when I query GeoServer (with a simple WFSGetFeature request), I get what seems to me a bad GML document. A single feature from the response is this (ddm is my own namespace's prefix):

<ddm:gmlfeature2 fid="gmlfeature2.0">
<ddm:name>MyName</ddm:name>
<ddm:description>MyDesc</ddm:description>
<ddm:extentOf>
  <gml:Polygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
   <gml:outerBoundaryIs>
    <gml:LinearRing>
     <gml:coordinates decimal="." cs="," ts=" ">-20,20 20,20 20,-20 -20,-20 -20,20</gml:coordinates>
    </gml:LinearRing>
   </gml:outerBoundaryIs>
  </gml:Polygon>
</ddm:extentOf>
</ddm:gmlfeature2>

I think it's bad because it puts every feature's attribute in my own namespace (ddm), but all those attributes (name, description) are from the standard GML 2 Schema, inherited from the base type AbstractFeatureType. extentOf is a GML-defined element, and as such it should be prefixed by "gml:", not by my own prefix "ddm:" (which doesn't define such element).

Am I right? Is there something I'm missing? Or this is a GeoServer behaviour and a GML data modeler *has* to design his/her data model with only custom attributes (all from the application namespace)?

Thanks in advance for any feedback.

Best regards,

Fabio Da Soghe

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:1003,44d8641c276421527717022!

--
Chris Holmes
The Open Planning Project
http://topp.openplans.org