Hello,
We’ve been making good progress with using GeoServer’s App-Schema extension to map a PostGIS database to a GMLAS, however we are now having difficulty with defining an App-Schema mapping that makes use of a join table. We’d be very grateful if someone could provide us assistance with the following problem:
I have in my PostGIS database two tables called “my_feature” and “link_table”. The columns and data that make up these two tables are given below:
Table “my_feature”
pk_id name
1 “Feature1”
2 “Feature2”
3 “Feature3”
Table “join_table”
fk_my_feature feature_data (integer)
1 1
2 2
2 3
3 4
3 5
3 6
The GML Application Schema that I am mapping to contains a complex type “MyFeatureType”, with the following properties:
<xs:element name=“featureName” type=“xs:string”/>
<xs:element name=“featureData” type=“xs:integer” minOccurs=“0” maxOccurs=”unbounded”/>
As you can see, the featureData element can have multiple values – what I am attempting to achieve is to join the “my_feature” and “join_table” tables where pk_id = fk_my_feature. This will give me all of the feature_data values for each feature. As such, I want to obtain a WFS response when I query for all the “MyFeatures” similar to the following:
”Feature1”
1
</wfs:member>
”Feature2”
2
3
</wfs:member>
”Feature3”
4
5
6
</wfs:member>
My question is, how should I define my FeatureTypeMapping in my App-Schema mapping file in order to produce the above result?
I’ve read in the documentation that “Feature chaining” may be used to achieve this effect, but the examples in the tutorials appear to require at least two features to be defined in the GMLAS. However, in my scenario, I only have one feature type to map against (“MyFeatureType”) – the join_table does not have a corresponding feature type defined in the GMLAS.
Can you also please advise if this scenario requires my tables to be denormalised prior to the App-Schema mapping, and what the performance implications of this might be, i.e:
Table “denormalised_table”
pk_id feature_name feature_data
1 “Feature A” 1
2 “Feature B” 2
2 “Feature B” 3
3 “Feature C” 4
3 “Feature C” 5
3 “Feature C” 6
Any assistance will be greatly appreciated
Best Regards,
Ryan