EDIT: This appears to be a version dependent issue! When I posted the question I was using Geoserver 2.11.1. I upgraded to the 2.12 nightly SNAPSHOT and I can now general GeodesyML output. The problem I'm currently solving is why my WFS returns a .application file with GeodesyML output that is totally unformatted.
Background Info:
My question is generally how to construct a mapping file for the GeodesyML schema but I think it will be useful to provide some background since very few people seem to be familiar with GeodesyML. I want to use Geoserver to serve GPS monument metadata from a PostGIS database and output XML according to the GeodesyML schema definition. I have regular GML output working (in a separate Geoserver workspace) so I know my database is accessible and I'm now trying to create the mapping from my database schema to the GeodesyML schema. See links below also.
Specific Question:
Why are my mapped features site_name
to siteName
and station_id
to fourCharacterID
not showing up in my WFS request output and how can I fix it? I believe my issue lies in my XPath given to in my mapping file below. I think I am missing something to deal with abstract XML types (most GeodesyML types are abstract) and Geoserver is getting confused. For example when I send a request to Geoserver such as
http://localhost:8080/geoserver/ows?service=WFS&version=1.1.0&request=GetFeature&typeName=gps_as:GeodesyML&outputFormat=gml32&maxFeatures=3
which specifies WFS version 1.1.0 and GML version 3.2 and limits the response to 3 items, I get a response like
<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs/2.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:gps_as="urn:xml-gov-au:icsm:egeodesy:0.4"
xmlns:gml="http://www.opengis.net/gml/3.2"
xmlns:gps="http://geoserver.org/gps"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
numberMatched="unknown" numberReturned="3" timeStamp="2017-06-20T19:17:19.347Z" xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://localhost:8080/geoserver/schemas/wfs/2.0/wfs.xsd urn:xml-gov-au:icsm:egeodesy:0.4 https://raw.githubusercontent.com/GeoscienceAustralia/GeodesyML/master/schemas/geodesyML.xsd http://www.opengis.net/gml/3.2
http://localhost:8080/geoserver/schemas/gml/3.2.1/gml.xsd">
<wfs:member>
<gps_as:GeodesyML gml:id="geoml_monuments.fid--43c4ca2_15cc63f75d5_-7f5a"/>
</wfs:member>
<wfs:member>
<gps_as:GeodesyML gml:id="geoml_monuments.fid--43c4ca2_15cc63f75d5_-7f59"/>
</wfs:member>
<wfs:member>
<gps_as:GeodesyML gml:id="geoml_monuments.fid--43c4ca2_15cc63f75d5_-7f58"/>
</wfs:member>
</wfs:FeatureCollection>
Relevant Links:
Here is the GeodesyML github page, including the .xsd files for GeodesyML: http://github.com/GeoscienceAustralia/geodesyml
Here is an interactive schema map for GeodesyML: http://geoscienceaustralia.github.io/GeodesyML-Github-Pages/
Here is documentation on how to create a mapping file for Geoserver App-Schema: http://docs.geoserver.org/stable/en/user/data/app-schema/mapping-file.html
Here is a tutorial on creating a (very simple) mapping file for GeoSciML: http://docs.geoserver.org/stable/en/user/data/app-schema/tutorial.html
Here is a blog post on making a mapping file for GeoSciML: http://lab.usgin.org/groups/building-geosciml-wfs-server/ncgmp-geosciml-mappedfeature
My Mapping File:
<?xml version="1.0" encoding="UTF-8"?>
<as:AppSchemaDataAccess
xmlns:as="http://www.geotools.org/app-schema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.geotools.org/app-schema AppSchemaDataAccess.xsd">
<namespaces>
<Namespace>
<prefix>geo</prefix>
<uri>urn:xml-gov-au:icsm:egeodesy:0.4</uri>
</Namespace>
<Namespace>
<prefix>gml</prefix>
<uri>http://www.opengis.net/gml/3.2</uri>
</Namespace>
<Namespace>
<prefix>gmd</prefix>
<uri>http://www.isotc211.org/2005/gmd</uri>
</Namespace>
</namespaces>
<includedTypes></includedTypes>
<sourceDataStores>
<DataStore>
<id>thedb</id>
<parameters>
<Parameter>
<name>dbtype</name>
<value>postgisng</value>
</Parameter>
<Parameter>
<name>host</name>
<value>fakeurl.unavco.org</value>
</Parameter>
<Parameter>
<name>port</name>
<value>5432</value>
</Parameter>
<Parameter>
<name>database</name>
<value>fakedb</value>
</Parameter>
<Parameter>
<name>user</name>
<value>fakeusername</value>
</Parameter>
<Parameter>
<name>passwd</name>
<value>fakepassword</value>
</Parameter>
</parameters>
</DataStore>
</sourceDataStores>
<catalog></catalog>
<targetTypes>
<FeatureType>
<!--<schemaUri>http://localhost/geodesyML_schemas/geodesyML.xsd</schemaUri>-->
<schemaUri>https://raw.githubusercontent.com/GeoscienceAustralia/GeodesyML/master/schemas/geodesyML.xsd</schemaUri>
</FeatureType>
</targetTypes>
<typeMappings>
<FeatureTypeMapping>
<sourceDataStore>thedb</sourceDataStore>
<sourceType>geoml_monuments</sourceType>
<!-- geoml_monuments is a materialized view in the postGIS database and it is used as the source schema, or the schema we are mapping FROM -->
<targetElement>geo:GeodesyML</targetElement>
<!-- is the root element of the target schema, GeodesyML -->
<attributeMappings>
<!--<AttributeMapping>
<targetAttribute>geo:GeodesyML</targetAttribute>
<targetAttributeNode>geo:GeodesyMLPropertyType</targetAttributeNode>
</AttributeMapping>
<AttributeMapping>
<targetAttribute>geo:AbstractSiteLog</targetAttribute>
<targetAttributeNode>geo:SiteLogType</targetAttributeNode>
</AttributeMapping>-->
<AttributeMapping>
<targetAttribute>geo:siteLog/geo:siteIdentification/geo:siteName</targetAttribute>
<sourceExpression><OCQL>site_name</OCQL></sourceExpression>
<encodeIfEmpty>true</encodeIfEmpty>
</AttributeMapping>
<AttributeMapping>
<targetAttribute>geo:siteLog/geo:siteIdentification/geo:fourCharacterID</targetAttribute>
<sourceExpression><OCQL>station_code</OCQL></sourceExpression>
<encodeIfEmpty>true</encodeIfEmpty>
</AttributeMapping>
</attributeMappings>
</FeatureTypeMapping>
</typeMappings>