Nuno,
that seems like a sensible solution, and backwards compatibility is
maintained.
Kind regards,
Ben.
On 24/12/17 10:06, Nuno Oliveira wrote:
Hi all,
Consider the following extract of an App-Schema defined feature type:
(...)
<st:Station gml:id="st.1">
<st:name>station1</st:name>
<st:position>
*<st:location>**
** <gml:Point srsDimension="2"
srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">**
** <gml:pos>-1.0 1.0</gml:pos>**
** </gml:Point>**
** </st:location>*
<st:name>Europe</st:name>
</st:position>
<st:measurements>
<ms:Measurement gml:id="ms.1">
<ms:name>temperature</ms:name>
</ms:Measurement>
</st:measurements>
(...)
Since the geometry is in a sub element it will not be recognized as the
default geometry and we need
to specify in the SLD the geometry XPath. My first try was to use the
following XPath:
<ogc:PropertyName>*st:Station**/*st:position/st:location</ogc:PropertyName>
To my surprise this didn't work, after debugging the code it looks like
the root feature type should not
be provided at the start of the XPath, so this is what should be used:
<ogc:PropertyName>*st:position/st:location*</ogc:PropertyName>
Consider the following valid SLD, note the filter usage:
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0"
xmlns="http://www.opengis.net/sld"
xmlns:gml="http://www.opengis.net/gml/3.2"
xmlns:ms="http://www.measurements.org/1.0"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:sld="http://www.opengis.net/sld"
xmlns:st="http://www.stations.org/1.0"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/sld
StyledLayerDescriptor.xsd">
<NamedLayer>
<Name>stations</Name>
<UserStyle>
<FeatureTypeStyle>
<Rule>
<Name>stations</Name>
<ogc:Filter>
<PropertyIsEqualTo>
<PropertyName>*st:measurements/ms:Measurement/ms:name*</PropertyName>
<Literal>wind</Literal>
</PropertyIsEqualTo>
</ogc:Filter>
<PointSymbolizer>
<sld:Geometry>
<ogc:PropertyName>*st:position/st:location*</ogc:PropertyName>
</sld:Geometry>
<Graphic>
<Mark>
<WellKnownName>square</WellKnownName>
<Fill>
<CssParameter name="fill">#FF0000</CssParameter>
</Fill>
</Mark>
<Size>6</Size>
</Graphic>
</PointSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
The same filter in a WFS GetFeature request will needs to be encoded
like this:
<wfs:GetFeature outputFormat="gml3" service="WFS" version="1.1.0"
xmlns:ms="http://www.measurements.org/1.0"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:st="http://www.stations.org/1.0"
xmlns:topp="http://www.openplans.org/topp"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.1.0/WFS-basic.xsd">
<wfs:Query typeName="st:Station">
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>
*st:Station/st:measurements/ms:Measurement/ms:name*
</ogc:PropertyName>
<ogc:Literal>wind</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>
In this case the root feature type name needs to be provided at the
beginning of the XPath.
Conclusion, the way of referencing properties of App-Schema defined
feature types is different
in WFS and WMS (at least for GetFeatrue and SLDs).
In my opinion the WFS GetFeature full XPath path is the most natural one
and both WFS and
WMS should use \ accept the same XPath.
I propose to allow the use of the full XPath in WMS (equal to WFS) but
keep accepting the shorten
one in WMS for compatibility reasons, opinions ?
My plan is to store as user data the target root name and root type name
here:
https://github.com/nmco/geotools/blob/22ab45c198130388c7774d8d43b051fc7a7402e6/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/config/AppSchemaDataAccessConfigurator.java#L297
and then in the feature accessor remove the root element from the XPath
id needed (based on the user data):
https://github.com/nmco/geotools/blob/66a9c89239d7a7ae6526399b57eb28649b5620c2/modules/extension/complex/src/main/java/org/geotools/filter/expression/FeaturePropertyAccessorFactory.java#L257-L285
This is the best way I found to do it ... better idea ?
Cheers,
Nuno Oliveira
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel
--
Ben Caradoc-Davies <[email protected]>
Director
Transient Software Limited <https://transient.nz/>
New Zealand
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel