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

Even Rouault even.rouault at mines-paris.org
Tue Dec 17 10:44:55 PST 2013


Le lundi 16 décembre 2013 10:25:35, Erik Gustafson a écrit :
> 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-out
> put, 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.
> 

I was initially thinking to attribute level templating, that I saw in the 
code, but it appears to be undocumented in the user documentation, and 
untested in the regression tests, so not sure if it works... Basically, from 
my reading of the source code of mapgml.c, if you define a metadata 

"gml_myattributename_template" 
"some_xml_having_$value_and_optionally_$namespace"

then myattributename will be replaced by 
"some_xml_having_$value_and_optionally_$namespace" where $value is substituted 
with the value of myattributename and $namespace with the namespace

But this will not help when creating nested groups of attributes (unless you 
use a horrible hack where the first attribute of the group has the xml opening 
tags, and the last one the xml closing tags !)

> 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.

Actually, you will be able to query features with FILTER and (the very limited 
subset of ) XPath (implemented by MapServer), but the XPath will be a "flat" 
one (i.e. the one that DescribeFeatureType will return), ignoring completely 
the OUTPUTFORMAT templating.

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

In MapServer ?

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

WFS 2.0 refers to "ISO 19143:2010, 7.4.4" (i.e. OGC 09-026r1 OpenGIS Filter 
Encoding 2.0 Encoding Standard) for the minimum XPath functionality.

> 
> 
> 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.

Yes those complex schemas are a major annoyance to both client and server 
worlds...

> 
> 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

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the Mapserver-inspire mailing list