[Mapserver-inspire] WFS, GML output, geometry mapping

Erik Gustafson gustafson.erik at gmail.com
Mon Dec 16 01:25:35 PST 2013


Thank you for responding,

yes I was trying to use the gml_xxx-mechanisms in LAYER->METADATA
configuration to create the XML structure. And you are right, it is
not enough to create the ad:address structure. I haven't managed to
nest "gml_groups" inside "gml_groups" so
<ad:address><ad:group><ad:groupcontent> is the deepest level I can
produce.

A feature template sounds interesting. The existing templating
functionality,http://mapserver.org/output/template_output.html#template-output,
looks quite powerful to me but haven't used it. One major reason why I
would like to use mapserver for WFS is to avoid having to work with
XML when some simple templating is enough. Actually we have Inspire
Download Services of predefined datasets in production and the XML for
those are created by filling templates.

The reason why I didn't create all XML inside the database or through
the SQL-query was because I quess I will lose the DescribeFeatureType
and ogc:Filter by Property XPath. Also my PostGIS 8.4 cannot produce
GML3.2.1-geometries.

I took a look at Deegree WFS now. For DescribeFeature they only
respond with they xml-schemas for the features, like this:
Query:
<wfs:DescribeFeatureType xmlns:wfs="http://www.opengis.net/wfs/2.0"
xmlns:ad="urn:x-inspire:specification:gmlas:Addresses:3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ows="http://www.opengis.net/ows/1.1" version="2.0.0"
service="WFS" xsi:schemaLocation="http://www.opengis.net/wfs/2.0
http://schemas.opengis.net/wfs/2.0/wfs.xsd">
  <wfs:TypeName>ad:Address</wfs:TypeName>
</wfs:DescribeFeatureType>

Response:
<?xml version='1.0' encoding='UTF-8'?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified" elementFormDefault="qualified"
targetNamespace="urn:x-inspire:specification:gmlas:Addresses:3.0">
  <include schemaLocation="http://localhost:8080/resources/appschemas/inspire/annex1/Addresses.xsd"/>
  <import namespace="urn:x-inspire:specification:gmlas:AdministrativeUnits:3.0"
schemaLocation="http://localhost:8080/resources/appschemas/inspire/annex1/AdministrativeUnits.xsd"/>
  <import namespace="urn:x-inspire:specification:gmlas:AirTransportNetwork:3.0"
schemaLocation="http://localhost:8080/resources/appschemas/inspire/annex1/AirTransportNetwork.xsd"/>
  <import namespace="urn:x-inspire:specification:gmlas:BaseTypes:3.2"
schemaLocation="http://localhost:8080/resources/appschemas/inspire/annex1/BaseTypes.xsd"/>
  <import namespace="urn:x-inspire:specification:gmlas:Buildings:0.0"
schemaLocation="http://localhost:8080/resources/appschemas/inspire/annex1/Buildings.xsd"/>
  <import namespace="urn:x-inspire:specification:gmlas:CadastralParcels:3.0"
schemaLocation="http://localhost:8080/resources/appschemas/inspire/annex1/CadastralParcels.xsd"/>
  <import namespace="urn:x-inspire:specification:gmlas:CommonTransportElements:3.0"
schemaLocation="http://localhost:8080/resources/appschemas/inspire/annex1/CommonTransportElements.xsd"/>
  <import namespace="urn:x-inspire:specification:gmlas:GeographicalNames:3.0"
schemaLocation="http://localhost:8080/resources/appschemas/inspire/annex1/GeographicalNames.xsd"/>
  <import namespace="urn:x-inspire:specification:gmlas:Network:3.2"
schemaLocation="http://localhost:8080/resources/appschemas/inspire/annex1/Network.xsd"/>
  <import namespace="urn:x-inspire:specification:gmlas:StatisticalUnits:0.0"
schemaLocation="http://localhost:8080/resources/appschemas/inspire/annex1/StatisticalUnits.xsd"/>
</schema>


So I quess the functionality I need is:
1) Templating, allowing me to put attributes as text or attribute on
elements. Currently only text content is possible(?) and not nested
deep down in the XML-hierarchy. Workaround is to produce the XML in
the SQL-query but I still need to tell mapserver to NOT print the
GML-geometry but still use the geometry for BBOX-filters etc. Looks
like OUTPOUTFORMAT-templating can accomplish this for me already but I
won't be able to query they features with XPath's.

2) Mapping the feature to XSD-schemas to be used in
DescribeFeatureType. This sounds simple enough to implement it myself.

3) Some functionality to map the output template to XPath-expressions.
I don't know what functionality is mandatory for WFS 2.0.


Any comments? I will go to our coffe machine and whine about why the
WFS server should respond with complex features the GIS-clients won't
understand instead of letting the end user map a simple GML-responses
to their schema of choice by using XSLT or something.

Regards
Erik Gustafson

On Fri, Dec 13, 2013 at 7:59 PM, Even Rouault
<even.rouault at mines-paris.org> wrote:
> Erik,
>
> The work done for WFS 2.0 doesn't address the issue of generating complex GML
> schemas. For attributes, several mechanisms can be used : gml_groups,
> gml_XXXX_template, gml_xml_items mechanism can be used to generate some
> nesting for attributes (but I'd be curious to know how you do that for the
> below schema. It doesn't seem obvious to me if you have one layer attribute
> for each GML element). But for geometries, there's no such capability. Perhaps
> we would need a GML template, not at the attribute level, but at the feature
> type level.
>
> Even
>
>> Hello list,
>>
>> I'm trying to setup Mapserver to serve Inspire Addresses with WFS 2.0
>> (thanks for the new work on wfs 2.0!), but there is one part failing
>> for me.
>> The XML according to
>> http://inspire.ec.europa.eu/schemas/ad/3.0/Addresses.xsd should be
>> looking something like this:
>>
>> <ad:Address>
>>     <ad:inspireId>
>>         <base:Identifier>
>>             <base:localId/>
>>             <base:namespace/>
>>        </base:Identifier>
>>     </ad:inspireId>
>>     <ad:position>
>>         <ad:GeographicPosition>
>>             <ad:geometry>INSERT GML GEOMETRY HERE</ad:geometry>
>>             <ad:specification></ad:specification>
>>             <ad:method></ad:method>
>>             <ad:default></ad:default>
>>         </ad:GeographicPosition>
>>     </ad:position>
>>     <ad:locator>
>>         <ad:AddressLocator>
>>             <ad:level/>
>>         </ad:AddressLocator>
>>     </ad:locator>
>>     <ad:validFrom/>
>>     <ad:beginLifespanVersion/>
>>     <ad:component/>
>> </ad:Address>
>>
>>
>> The problem is that I can't find a way to define where in the XML to
>> insert the Geomtry.I want to tell mapserver to put the geometry inside
>> the ad:GeographicPosition-element.
>> The other parts of the hierarchical XML seems possible so far...
>>
>>
>> Any ideas how to insert the gml-geometry?
>>
>> Is anyone else using Mapserver för Inspire WFS?
>>
>> regards
>> Erik Gustafson
>> _______________________________________________
>> Mapserver-inspire mailing list
>> Mapserver-inspire at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-inspire
>
> --
> Geospatial professional services
> http://even.rouault.free.fr/services.html


More information about the Mapserver-inspire mailing list