Hello everyone,
I am a new user of this library and I have some difficulties to get
familiar with it.
My first question is: how can I get features from a wfs response using SIS
(Gtk) library?
I’ve tried to create a new WFS client, but unfortunately I didn’t find
neither tutorials nor examples showing how to do this.
So I tried the following code :
URL url=*new* URL("http://geoservices.brgm.fr/geologie?service=wfs");
WebFeatureClient *wfs*=new WebFeatureClient(*url*, "1.1.0");
String [] names=wfs.getTypeNames();
With the code below, I’ve got the following exceptions:
Avertissement: JAXB exception while reading imported schema:
http://schemas.opengeospatial.net/gml/3.1.1/base/gml.xsd
*javax.xml.bind.UnmarshalException*
- with linked exception:
[org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 55; Des
espaces sont obligatoires entre les ID publicId et systemId.]
at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(
*AbstractUnmarshallerImpl.java:335*)
…
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 55;
Des espaces sont obligatoires entre les ID publicId et systemId.
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(
*ErrorHandlerWrapper.java:198*)
... 18 more
juil. 30, 2016 4:33:45 PM org.geotoolkit.feature.xml.Utils getDistantSchema
Avertissement: Schema ressource not found:
http://schemas.opengeospatial.net/gml/3.1.1/base/gml.xsd
juil. 30, 2016 4:33:45 PM
org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader listAllSchemas
Avertissement: Unable to retrieve imported schema:
http://schemas.opengeospatial.net/gml/3.1.1/base/gml.xsd
Exception in thread "main" *org.opengis.feature.MismatchedFeatureException*:
Unable to find complex type for name : {
http://www.opengis.net/gml}AbstractFeatureType
at org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader.getType(
*JAXBFeatureTypeReader.java:611*)
…
I’ve tried another way to get a response from the wfs server using the
following code:
URL url=*new* URL("http://geoservices.brgm.fr/geologie?service=wfs");
*final* Iterator<ClientFactory> ite = DataStores.*getAllFactories*
(ClientFactory.*class*).iterator();
*while*(ite.hasNext()){
* final* ClientFactory factory = ite.next();
* final* ParameterDescriptorGroup description = factory
.getParametersDescriptor();
* final* ParameterValueGroup params = description.createValue();
params.parameter("identifier").setValue("wfs");
params.parameter("url").setValue(url);
params.parameter("version").setValue("1.1.0");
* final* DataStore *server* = factory.create(params);
}
Using the code above, I’ve got the following error:
Exception in thread "main" *org.apache.sis.storage.DataStoreException*: Can
not create any new WFS DataStore
at org.geotoolkit.data.wfs.WFSFeatureStoreFactory.create(
*WFSFeatureStoreFactory.java:144*)
at org.geotoolkit.data.wfs.WFSFeatureStoreFactory.create(
*WFSFeatureStoreFactory.java:46*)
My second question is : Does the library support the version 2.0.0 of wfs?
I tried to specify in parameters shown above the value “2.0.0” but I’ve got
an error saying : “2.0.0” is an unknow version value!
I am using java7 and this is an extract from my POM.xml:
<properties>
<geotk.version>4.0-M5</geotk.version>
</properties>
<dependencies>
<dependency>
<groupId>org.geotoolkit</groupId>
<artifactId>*geotk*-referencing</artifactId>
<version>${geotk.version}</version>
</dependency>
<dependency>
<groupId>org.geotoolkit</groupId>
<artifactId>*geotk*-client-*wfs*</artifactId>
<version>${geotk.version}</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>*geotoolkit*</id>
<name>*Geotk* repository</name>
<url>http://maven.geotoolkit.org</url>
</repository>
</repositories>
</project>
Thank you,
Best regards
--
Hanane ELJABIRI, Élève ingénieur en Géomatique
Cycle ingénieur en double diplôme
L'École Nationale des Sciences Géographiques (ENSG)
L'École Hassania des Travaux Publics (EHTP)https://fr.linkedin.com/in/heljabiri
Tél : (+33)664624473