MOVED to geotools-gt2-users list
Sorry for duplication. I got yesterday a long delayed system message about
blocking the previous users list mail because of a ZIP attachment (I changed it
to 7zip now). Now the mail only waits for moderation because of its content
length.
Regards
Robin
Von: Robin Pradel [mailto:r...@ivu.de]
Gesendet: Mittwoch, 3. Januar 2018 19:47
An: geotools-devel@lists.sourceforge.net
Betreff: [Geotools-devel] Struggling with WFS 2.0.0: GetCapabilities
(ows:Parameter not found) + PropertyIsLike filter (two expressions not allowed)
>>> tried to mail this at
>>> geotools-gt2-us...@lists.sourceforge.net<mailto:geotools-gt2-us...@lists.sourceforge.net>
>>> but it does not show up and there are no new mails since 2017-12-22 o_O
Hi there,
TL;DR
* Using Geotools 18.1
* GetCapabilities: ows:Parameter "outputFormat" and "srsName" could not
be found within ows:Operation (because it is allowed to place them next to
ows:Operation)
* PropertyIsLike filter created by FilterFactory2 does not allow two
expressions (pattern should be generated by server-side function)
* Simple maven project attached
I try to use a public WFS service in version 2.0.0 and have problems while
simply retrieving some features. The following code leads to an exception
"java.lang.IllegalArgumentException: Client does not support any of the server
supported output formats for DESCRIBE_FEATURETYPE":
import java.util.Arrays;
import java.util.Collections;
import org.geotools.data.DataStore;
import org.geotools.data.DataStoreFinder;
import org.geotools.data.Query;
import org.geotools.data.simple.SimpleFeatureCollection;
import org.geotools.data.simple.SimpleFeatureIterator;
public class WfsTestApp {
public static void main(String[] args) throws Exception {
String getCapabilities =
"http://isk.geobasis-bb.de/ows/dog_lgb200_bebb_v3?SERVICE=WFS&REQUEST=GetCapabilities&ACCEPTVERSIONS=";
getCapabilities += "2.0.0"; // [1]
// getCapabilities += "1.1.0"; // [2]
DataStore data =
DataStoreFinder.getDataStore(Collections.singletonMap("WFSDataStoreFactory:GET_CAPABILITIES_URL",
getCapabilities));
String typeNames[] = data.getTypeNames();
Arrays.stream(typeNames).sorted().forEach(System.out::println);
String typeName = "dog:Strassen";
Query q = new Query(typeName);
q.setMaxFeatures(5);
// FilterFactory2 ff2 = CommonFactoryFinder.getFilterFactory2();
// Literal literal = ff2.literal("_Seestrassse_");
// Function function = ff2.function("normalize", literal);
// PropertyIsLike like =
ff2.like(ff2.property("dog:strassenname_normalisiert"), function, "_", "?",
"!"); // [3]
// q.setFilter(like);
SimpleFeatureCollection features =
data.getFeatureSource(typeName).getFeatures(q);
System.out.println("Size: " + features.size()); // expected 5 but
was 51331 ... anyway! [4]
try (SimpleFeatureIterator iter = features.features()) {
while (iter.hasNext()) {
System.out.println(iter.next());
}
}
}
}
I tracked it down to a new (WFS 2.0.0) optional structure in the
GetCapabilities document, by which it is possible to locate the ows:Parameters
next to ows:Operation instead of a nested element within the ows:Operation.
(OpenGIS Web Feature Service 2.0 Interface Standard (also ISO
19142)<http://portal.opengeospatial.org/files/?artifact_id=39967> -
http://www.opengeospatial.org/standards/wfs) chapter 8.3.5.1 page 49 ).
If I force version 1.1.0 (in code [2]) it works well because the following
structure is returned on the GetCapabilities request and gets fully parsed:
[cid:image001.png@01D38546.D7E0B870]
Switching to version 2.0.0 (in code [1]) the service delivers a valid
GetCapabilities document, which leads to the mentioned exception above, because
the "outputFormat" and later the "srsName" couldn't be found:
[cid:image002.png@01D38546.D7E0B870]
Did I miss any tweaks or options to make it work or is this a known issue I
have to treat?
Using version 1.1.0 as workaround is not an option because I want to use a
server-side function called "normalize" to generate the second input parameter
for the PropertyIsLike filter. The desired request should look like this:
<?xml version="1.0" encoding="utf-8"?>
<wfs:GetFeature version="2.0.0" count="5" outputFormat="text/xml;
subtype=gml/3.1.1" xmlns:fes="http://www.opengis.net/fes/2.0"
xmlns:wfs="http://www.opengis.net/wfs/2.0"
xmlns:app="http://www.deegree.org/app"
xmlns:dog="http://www.adv-online.de/namespaces/adv/dog"
xmlns:iso19112="http://www.opengis.net/iso19112" resultType="results">
<wfs:Query typeNames="dog:Strassen" srsName="EPSG:25833">
<Filter xmlns="http://www.opengis.net/fes/2.0">
<PropertyIsLike wildCard="_" singleChar="?" escapeChar="!">
<ValueReference>dog:strassenname_normalisiert</ValueReference>
<Function name="normalize">
<Literal>_Seestrassse_</Literal>
</Function>
</PropertyIsLike>
</Filter>
</wfs:Query>
</wfs:GetFeature>
And here is my second problem. The FilterFactory2 does not allow the creation
of a PropertyIsLike filter with Function as second parameter - the pattern (in
code [3]). It only allows a String as literal input. According to the OpenGIS
Filter Encoding 2.0 Encoding
Standard<http://portal.opengeospatial.org/files/?artifact_id=39968> chapter
7.7.1 and 7.7.2 (page 19-20) the PropertyIsLike filter now allows two
expressions instead of only a property name and a literal (Filter Encoding 1.1
Standard). How can I achieve the request above? Maybe there is a possibility to
create my own filter or does it probably exist already and I didn't found it?!
For a quick replay of these issues, I attached a small maven project (7zip
archive; zip: https://ufile.io/jrof4 ). I use Geotools 18.1, Java 8 and Maven
3.3.3.
I hope somebody can help me make it work. Thanks in advance.
Yours sincerely.
M.Sc. Robin Pradel
Senior Software Engineer
IVU Traffic Technologies AG
Bundesallee 88, D-12161 Berlin
http://www.ivu.de<http://www.ivu.de/>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel