Hi all,
Consider the following extract of an App-Schema defined feature type:
(…)
<st:Station gml:id=“st.1”>
st:namestation1</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:nameEurope</st:name>
</st:position>
st:measurements
<ms:Measurement gml:id=“ms.1”>
ms:nametemperature</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:PropertyNamest: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:PropertyNamest: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”>
stations
stations
ogc:Filter
st:measurements/ms:Measurement/ms:name
wind
</ogc:Filter>
sld:Geometry
ogc:PropertyNamest:position/st:location</ogc:PropertyName>
</sld:Geometry>
square
#FF0000
6
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:Literalwind</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
···
--
Regards,
Nuno Oliveira
==
GeoServer Professional Services from the experts! Visit [http://goo.gl/it488V](http://goo.gl/it488V) for more information.
==
Nuno Miguel Carvalho Oliveira
@nmcoliveira
Software Engineer
GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
[http://www.geo-solutions.it](http://www.geo-solutions.it)
[http://twitter.com/geosolutions_it](http://twitter.com/geosolutions_it)
-------------------------------------------------------
AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.
The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.