0

I am working on an Application Schema example. The dataset is being built, the layer will be rendered as WMS, but the WFS-GML Output produces an empty tag where a Point geometry would be expected. I already reduced my complex schema to a rather simple one and spent days trying to find the cause. Observations will follow further down.


Here is my application schema:

<!--Generated by Enterprise Architect 13.5.1351 ( Build: 1351 )-->
<xs:schema elementFormDefault="qualified" targetNamespace="http://geoserver.org/xe" version = "2.03"
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:xe="http://geoserver.org/xe"
xmlns:gml="http://www.opengis.net/gml/3.2">
    <!--xs:import namespace="http://www.opengis.net/gml/3.2" schemaLocation="../../net/opengis/schemas/gml/3.2.1/gmlBase.xsd"/-->
    <xs:element name="XE_OrtVonInteresse" type="xe:XE_OrtVonInteresseType" substitutionGroup="gml:AbstractFeature" abstract="true"></xs:element>
    <xs:complexType name="XE_OrtVonInteresseType" abstract="true">
        <xs:complexContent>
            <xs:extension base="gml:AbstractFeatureType">
                <xs:sequence>
                    <xs:element name="ovi_id" type="xs:integer"/>
                    <xs:element name="objektUUID" type="xs:string"/>
                    <xs:element name="objektName" type="xs:string"/>
                    <xs:element name="lageanfasspunkt" type="gml:PointPropertyType" minOccurs="1" maxOccurs="1"/>
                    <!--<xs:element name="lageAnfasspunkt" type="gml:GeometryPropertyType" minOccurs="1" maxOccurs="1"/>-->             
                    <xs:element name="objektFunktion" type="xs:string"/>
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
        <xs:element name="XE_Aussichtspunkt" type="xe:XE_AussichtspunktType" substitutionGroup="xe:XE_OrtVonInteresse"></xs:element>
    <xs:complexType name="XE_AussichtspunktType">
        <xs:complexContent>
            <xs:extension base="xe:XE_OrtVonInteresseType">
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
</xs:schema>```


----------

Here is my MappingFile

    ```<?xml version="1.0" encoding="UTF-8"?>
    <as:AppSchemaDataAccess xmlns:as="http://www.geotools.org/app-schema" xmlns:xe="http://geoserver.org/xe" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.geotools.org/app-schema AppSchemaDataAccess.xsd">
        <namespaces>
            <Namespace>
                <prefix>gml</prefix>
                <uri>http://www.opengis.net/gml/3.2</uri>
            </Namespace>
            <Namespace>
                <prefix>xe</prefix>
                <uri>http://geoserver.org/xe</uri>
            </Namespace>
        </namespaces>
        <includedTypes> 
        </includedTypes>
        <sourceDataStores>
         <DataStore>
            <id>test_ds</id>
        <parameters>
            <Parameter>
                <name>dbtype</name>
                <value>postgisng</value>
            </Parameter>
            <Parameter>
                <name>host</name>
                <value>localhost</value>
            </Parameter>
            <Parameter>
                <name>port</name>
                <value>5432</value>
            </Parameter>
            <Parameter>
                <name>database</name>
                <value>xe_db</value>
            </Parameter>
            <Parameter>
                <name>user</name>
                <value>ca</value>
            </Parameter>
            <Parameter>
                <name>passwd</name>
                <value>clandrae</value>
            </Parameter>
            <Parameter>
                <name>schema</name>
                <value>xe_gs</value>
            </Parameter>
            <Parameter>
                <name>Expose primary keys</name>
                <value>true</value>
            </Parameter>
        </parameters>
        </DataStore>
        </sourceDataStores>
        <!--<catalog>catalog.xml</catalog>-->
        <targetTypes>
            <FeatureType>
                 <schemaUri>test.xsd</schemaUri>
            </FeatureType>
        </targetTypes>
        <typeMappings>
          <FeatureTypeMapping>
                <sourceDataStore>test_ds</sourceDataStore>
                <sourceType>test2</sourceType>
                <targetElement>xe:XE_Aussichtspunkt</targetElement>
                <defaultGeometry>xe:lageanfasspunkt</defaultGeometry>
                <attributeMappings>
                      <AttributeMapping>
                        <targetAttribute>xe:XE_Aussichtspunkt</targetAttribute>
                        <idExpression><OCQL>ovi_code_id</OCQL></idExpression>
                    </AttributeMapping>
                     <AttributeMapping>
                        <targetAttribute>xe:ovi_id</targetAttribute>
                        <sourceExpression><inputAttribute>ovi_id</inputAttribute></sourceExpression>
                    </AttributeMapping>
                    <AttributeMapping>
                        <targetAttribute>xe:lageanfasspunkt</targetAttribute>
                        <targetAttributeNode>gml:PointPropertyType</targetAttributeNode>
                        <sourceExpression><OCQL>lageanfasspunkt</OCQL></sourceExpression>
                        <idExpression><OCQL>strConcat('point_',ovi_code_id)</OCQL></idExpression>
                    </AttributeMapping>
                    <AttributeMapping>
                        <targetAttribute>xe:objektUUID</targetAttribute>
                        <sourceExpression><inputAttribute>objektuuid</inputAttribute></sourceExpression>
                    </AttributeMapping>
                      <AttributeMapping>
                        <targetAttribute>xe:objektName</targetAttribute>
                        <sourceExpression><inputAttribute>objektname</inputAttribute></sourceExpression>
                    </AttributeMapping>
                     <AttributeMapping>
                        <targetAttribute>xe:objektFunktion</targetAttribute>
                        <sourceExpression><inputAttribute>objektfunktion</inputAttribute></sourceExpression>
                    </AttributeMapping>
                    </attributeMappings>
            </FeatureTypeMapping>
        </typeMappings>
    </as:AppSchemaDataAccess>

And here is my PostGIS table:

        ovi_id integer,
        ovi_code_id text,
        objektname text NOT NULL,
        objektuuid text,
        objektfunktion text,
        lageanfasspunkt public.geometry(Point,25832) NOT NULL
    );

    ALTER TABLE xe_gs.test2 OWNER TO ca;

    INSERT INTO xe_gs.test2 VALUES (373, '2384', 'Sternwarte auf dem Galgenberg', '46873230-b825-e8aa-4c57-1d7ed0750964', 'Aussichtspunkt', '0101000020E8640000BECF5188FAE91841A1FEBC2589D05541');
    INSERT INTO xe_gs.test2 VALUES (1214, '2385', 'Varnhöveler Warte', 'e80dc111-ffb3-9e35-504c-9a587946f96a', 'Aussichtspunkt', '0101000020E8640000C15D2E3EB08118413A8184D66FD55541');
    INSERT INTO xe_gs.test2 VALUES (19, '1194', 'Galgenberg', 'b3524707-b8b3-a439-6bf8-d489f2e7f4e5', 'Aussichtspunkt', '0101000020E864000059A308D3C8E8184152A7E01172D05541');
    INSERT INTO xe_gs.test2 VALUES (2552, '1207', 'Adener Höhe', '69c611b8-93b3-efbd-febe-be53f9c55ccc', 'Aussichtspunkt', '0101000020E86400007B176FCD14A918414FCC35AAF1D15541');
    INSERT INTO xe_gs.test2 VALUES (159, '1238', 'Test-Punkt', '31ffccc9-2878-6bf2-d228-1f2a3c40d5d6', 'Aussichtspunkt', '0101000020E86400000000000090DE18410000004077CE5541');
    INSERT INTO xe_gs.test2 VALUES (88, '2314', 'Zeche Monopol', '0f646068-9a93-c9d7-3f4f-d39a7f0fdb75', 'Aussichtspunkt', '0101000020E86400005EF0715D3CCD184152DBE97449CE5541');

And this is the GML Output:

<lageanfasspunkt> is supposed to contain a POINT geometry. The logging does not show any errors. The geometry is interpreted correctly. WMS rendering is possible. However, the element lageanfasspunkt remains empty.

<?xml version="1.0" encoding="UTF-8"?><wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xe="http://geoserver.org/xe" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" numberMatched="unknown" numberReturned="6" timeStamp="2020-03-22T12:58:04.801Z" xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://localhost:8080/geoserver/schemas/wfs/2.0/wfs.xsd http://geoserver.org/xe file:/C:/Program%20Files%20(x86)/geoserver-2.16.2/data_dir/data/xe/test.xsd http://www.opengis.net/gml/3.2 http://localhost:8080/geoserver/schemas/gml/3.2.1/gml.xsd"><wfs:member>
<xe:XE_Aussichtspunkt gml:id="1194">
<xe:ovi_id>19</xe:ovi_id>
<xe:objektUUID>b3524707-b8b3-a439-6bf8-d489f2e7f4e5</xe:objektUUID>
<xe:objektName>Galgenberg</xe:objektName>
<xe:lageanfasspunkt/>
<xe:objektFunktion>Aussichtspunkt</xe:objektFunktion></xe:XE_Aussichtspunkt></wfs:member><wfs:member>
<xe:XE_Aussichtspunkt gml:id="1207">
<xe:ovi_id>2552</xe:ovi_id>
<xe:objektUUID>69c611b8-93b3-efbd-febe-be53f9c55ccc</xe:objektUUID>
<xe:objektName>Adener Höhe</xe:objektName>
<xe:lageanfasspunkt/>
<xe:objektFunktion>Aussichtspunkt</xe:objektFunktion></xe:XE_Aussichtspunkt></wfs:member><wfs:member>
<xe:XE_Aussichtspunkt gml:id="1238">
<xe:ovi_id>159</xe:ovi_id>
<xe:objektUUID>31ffccc9-2878-6bf2-d228-1f2a3c40d5d6</xe:objektUUID>
<xe:objektName>Test-Punkt</xe:objektName>
<xe:lageanfasspunkt/>
<xe:objektFunktion>Aussichtspunkt</xe:objektFunktion></xe:XE_Aussichtspunkt></wfs:member><wfs:member>
<xe:XE_Aussichtspunkt gml:id="2314">
<xe:ovi_id>88</xe:ovi_id>
<xe:objektUUID>0f646068-9a93-c9d7-3f4f-d39a7f0fdb75</xe:objektUUID>
<xe:objektName>Zeche Monopol</xe:objektName>
<xe:lageanfasspunkt/>
<xe:objektFunktion>Aussichtspunkt</xe:objektFunktion></xe:XE_Aussichtspunkt></wfs:member><wfs:member>
<xe:XE_Aussichtspunkt gml:id="2384">
<xe:ovi_id>373</xe:ovi_id>
<xe:objektUUID>46873230-b825-e8aa-4c57-1d7ed0750964</xe:objektUUID>
<xe:objektName>Sternwarte auf dem Galgenberg</xe:objektName>
<xe:lageanfasspunkt/>
<xe:objektFunktion>Aussichtspunkt</xe:objektFunktion></xe:XE_Aussichtspunkt></wfs:member><wfs:member>
<xe:XE_Aussichtspunkt gml:id="2385">
<xe:ovi_id>1214</xe:ovi_id>
<xe:objektUUID>e80dc111-ffb3-9e35-504c-9a587946f96a</xe:objektUUID>
<xe:objektName>Varnhöveler Warte</xe:objektName>
<xe:lageanfasspunkt/>
<xe:objektFunktion>Aussichtspunkt</xe:objektFunktion></xe:XE_Aussichtspunkt></wfs:member></wfs:FeatureCollection>

What did I try so far?

- Switch to GeoSever 2.16 from version 2.14. 
- PostGIS table with/without OIDs
- PostGIS table and xsd-Schema with type Geometry vs type Point
- Use SRID 4326 instead of 25832
- Use View instead of table
- Control geometry_columns; this is an automatically updated view and contains my table/view-Information.
- Control Namespace declarations and add a Secondary Namespace-Declaration for GML.
- Try mapping File with and without default_geometry declaration.
- Try lowercase field names instead of lowerCamelCase. 
- Try renaming 'lageanfasspunkt' to 'the_geom'.
- Try different GML versions. GML2.0 doesnt work due to schema incompatibility.
- GML-Output format 3.1 makes no difference to 3.2.
- Try WFS GET vs Post
- Try GML-Namespace-Declaration in WFS-POST-Request
- Try using various WFS-Requests like

    http://localhost:8080/geoserver/xe/wfs?service?WFS&version=2.0.0&request=GetFeature&typeNames=xe:XE_Aussichtspunkt&format=application/gml+xml;version=3.2

Observations:

  • WMS works with default Style point.
  • Defining an own style results in GeoServer not finding the geometry, also when explicitly defined in the symbolizer.
  • GeoJSON Output possible with correct Point definition (>> GeoServer is able to build the points!).

Any suggestions?

1

I got a response via the geoserver email forum with a suggestion for the xsd schema. The import of gml-namespace must not be deactivated. So here is the working schema:

<xs:schema elementFormDefault="qualified" targetNamespace="http://geoserver.org/xe" version = "2.03"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:xe="http://geoserver.org/xe"
    xmlns:gml="http://www.opengis.net/gml/3.2">;
    <xs:import namespace="http://www.opengis.net/gml/3.2" schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd" />
    <xs:element name="XE_OrtVonInteresse" type="xe:XE_OrtVonInteresseType" substitutionGroup="gml:AbstractFeature" />
    <xs:complexType name="XE_OrtVonInteresseType" abstract="true">
        <xs:complexContent>
            <xs:extension base="gml:AbstractFeatureType">
                <xs:sequence>
                    <xs:element name="ovi_id" type="xs:integer"/>
                    <xs:element name="objektUUID" type="xs:string"/>
                    <xs:element name="objektName" type="xs:string"/>
                    <xs:element name="lageanfasspunkt" type="gml:GeometryPropertyType" minOccurs="1" maxOccurs="1"/>         
                    <xs:element name="objektFunktion" type="xs:string"/>
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <xs:element name="XE_Aussichtspunkt" type="xe:XE_AussichtspunktType" substitutionGroup="xe:XE_OrtVonInteresse"/>
    <xs:complexType name="XE_AussichtspunktType">
        <xs:complexContent>
            <xs:extension base="xe:XE_OrtVonInteresseType">
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
</xs:schema>

This solved the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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