[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[udig-devel] Workaround for UDIG-909
|
Hi all,
As a workaround for UDIG-909 I have decided to create my own
WFSDataStore to query for features. I do this by reading the URL from
the WFS layer that I want to query and creating a new WFSDataStore using
the following code:
FeatureSource origFeatureSource = layer.getResource(FeatureSource.class, null);
WFSDataStoreFactory fact = new WFSDataStoreFactory();
java.util.Map params = new HashMap();
params.put(fact.URL.key, layer.getGeoResource().getIdentifier());
params.put(fact.PROTOCOL.key, Boolean.TRUE);
params.put(fact.TIMEOUT.key, new Integer(6000));
DataStore ds = fact.createNewDataStore(params);
FeatureSource featureSource = ds.getFeatureSource(origFeatureSource.getSchema().getTypeName());
logger.info("Searching for features using query: " + newQuery.toString());
FeatureCollection results = featureSource.getFeatures(newQuery);
This works well, but I'm convinced there must be a better way of
retrieving the WFS parameters from the existing datastore, or even that
there may be some sort of Util class floating around that can clone
DataStores.
Any ideas?
Thanks,
Mark
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
begin:vcard
fn:Mark Presling
n:Presling;Mark
email;internet:mark@xxxxxxxxxxxx
tel;home:+6442322774
tel;cell:+6421549540
version:2.1
end:vcard