Hi everyone,

I have some issues with the  WFS-NG extension of Geotools 14.3.

I am using the code below to get a data store from a distant server :

String getCapabilities = "
http://ids.craig.fr/wxs/public/wfs?request=getcapabilities&version=2.0.0";;
            *Map* connectionParameters = *new* *HashMap*();

             *connectionParameters**.put(*
*"WFSDataStoreFactory:GET_CAPABILITIES_URL"**, **getCapabilities** )*;

             *connectionParameters**.put(*
*"WFSDataStoreFactory:WFS_STRATEGY"**, **"geoserver"**)*;



             // Step 2 - connection

             DataStore data = DataStoreFinder.*getDataStore*(
connectionParameters );



             // Step 3 - *discouvery*

             String typeNames[] = data.getTypeNames();

             String typeName = typeNames[0];

             SimpleFeatureType *schema* = data.getSchema( typeName );



             // Step 4 - target

             SimpleFeatureSource source = data.getFeatureSource(typeName);



             // Step 5 - query





             Query query = *new* Query();

             CoordinateReferenceSystem crs=source.getInfo().getCRS();

             query.setCoordinateSystem(crs);

             query.setMaxFeatures(100);



              SimpleFeatureCollection fc = source.getFeatures(query);

                 SimpleFeatureIterator  fiterator=fc.features();

                 *while*(fiterator.hasNext()){

                    SimpleFeature sf = fiterator.next();

                    addFeature(sf,crs);

                    System.*out*.println(sf.getName());

                 }

The execution of this code raises the following error:

Exception in thread "main" *java.lang.ClassCastException*:
net.opengis.wfs20.impl.WFSCapabilitiesTypeImpl cannot be cast to
net.opengis.wfs.WFSCapabilitiesType

       at
org.geotools.data.wfs.internal.v1_x.StrictWFS_1_x_Strategy.setCapabilities(
*StrictWFS_1_x_Strategy.java:411*)

       at org.geotools.data.wfs.internal.WFSClient.<init>(
*WFSClient.java:71*)

       at org.geotools.data.wfs.internal.WFSClient.<init>(
*WFSClient.java:62*)

       at org.geotools.data.wfs.WFSDataStoreFactory.createDataStore(
*WFSDataStoreFactory.java:117*)

       at org.geotools.data.wfs.WFSDataStoreFactory.createDataStore(
*WFSDataStoreFactory.java:70*)

       at org.geotools.data.DataAccessFinder.getDataStore(
*DataAccessFinder.java:130*)

I don’t understand why the method
org.geotools.data.wfs.internal.v1_x.StrictWFS_1_x_Strategy.setCapabilities
is called instead of
org.geotools.data.wfs.internal.v2_0.StrictWFS_2_0_Strategy.setCapabilities !

Is there a missing parameter in my configuration which I need to add to
force the use of v2_0.StrictWFS_2_0_Strategy class?

I would appreciate any help with that,

Best regards
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to