In uDig we cached the capabilities document on disk locally - for WFS or
WMS cannot remember which, in order to quickly reconnect.

The WFS protocol does expect clients to do version negotiation, retrieve a
capabilities document, describe feature type and then get features.

There have been requests for WFS protocol to get a bit smarter (offer
paging or a filter parameter when connecting) but I have not looked if any
of them made it into the WFS 2.0 specification.

I guess if you really control both server and client short cut the
datastore the GML parsers are available and you can issue your
GetFeatureRequest by hand.


--
Jody Garnett

On 12 August 2015 at 05:12, Emmanuel Seguin <emmanuel.seg...@ign.fr> wrote:

> Hi,
>
> I'm writing a little program in which I will be querying objects from a
> WFS as part of a bigger process.
>
> I'm using the WFSDataStoreFactory to create a WFSDataStore => Trouble is
> the creation of the WFSDataStore seems to mean getcapabilities download and
> parsing, something I don't really need given the fact I already know the
> typename and the request parameters I want to use.
> The getcapabilities I'm downloading is pretty big (~1Mb) so the program is
> hanging for a while before querying the features.
>
> Is there a way to bypass the use of the WFSDataStore to query directly a
> WFS server and get a SimpleFeatureCollection ?
>
> I'm copying below the relevant part of the code I'm currently using.
>
> Thanx in advance,
>
> // Step 1 - Connection parameters
> Map connectionParameters = new HashMap();
>
> connectionParameters.put("WFSDataStoreFactory:GET_CAPABILITIES_URL",getCapabilities);
> connectionParameters.put("WFSDataStoreFactory:TIMEOUT", 15000);
> connectionParameters.put("WFSDataStoreFactory:WFS_STRATEGY", "geoserver");
>
> // Step 2 - Get WFSDataStore
> WFSDataStoreFactory  dsf = new WFSDataStoreFactory();
> WFSDataStore data = dsf.createDataStore(connectionParameters);
>
> // Step 3 - Get SimpleFeatureSource
> String typeName = "myTypeName";
> SimpleFeatureSource source = data.getFeatureSource( typeName );
>
> // Step 4 - Create intersects filter
> FilterFactory2 ff =
> CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints());
> ReferencedEnvelope clipEnv = new ReferencedEnvelope(xmin, xmax, ymin,
> ymax, _crs);
> Polygon clipPolygon = JTS.toGeometry(clipEnv);
> Intersects filter =
> ff.intersects(ff.property("geom"),ff.literal(clipPolygon));
>
> // Step 5 - Grab data
> SimpleFeatureCollection features = source.getFeatures(filter);
>
> ------------------------------------------------------------------------------
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
------------------------------------------------------------------------------
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to