Thank Jody, I’ll give it a try and dig into the WFS module to create requests and handle responses. Justin is mentioned as a module maintainer in the pom of the WFS module. Could he or anybody else answer questions like
- Where to start,
- DO’s and DONT’s
- What I have to care about (e.g. side effects)
- Changes between 2.5.x and trunk (I need functionality in an older gt-version for a project but would like to provide a patch for trunk too)
Cheers,
Frank
2010/11/1 Jody Garnett <jody.garnett@anonymised.com>
Back to your original request; the code could be modified to issue a single request for all the GetFeatureType information; and then parse out the results into FeatureTypes. I could see how that would make things faster; it is up to you if you would like to proceed with the idea.
I just looked into the wfs pom to see who ist the modul maintainer. Justin, do you know other feature requests like this for the wfs module? I’m interested in implementing this behaviour but need a hint where to start and what I have to take care about.
Jody
On 26/10/2010, at 7:23 PM, Frank Gasdorf wrote:
2010/10/26 Jody Garnett <jody.garnett@anonymised.com>
The WFS datastore does not support a query across several feature
types in a single request. In part this is due to our feature
collections being restricted to a single feature type.Yes I recognized that a FeatureColection can only contain one SimpeFeatureType. Could I find any utility classes to query a WFSServer and get a Map SimpleFeatureTypes as keys and FeatureCollection as values? Or with other words, how can I get access to as WFS Server without using creating a DataStore. I guess there are Response classes which can handle mixed results of types.
If not, could that be a feature anybody else could need? Does anybody have use case to requests queries like the geoserver demo-MulitFeature request? Who had created the demo-request?
There should be way to refer to the default geometry with a simple
xpath expression that works for all features; not sure if it applys to
WFS or only to the SLD rendering engine.Could you give an example. I’ve no clue how to define a xpath expression … Thanks
Frank
Jody
On Tue, Oct 26, 2010 at 5:14 PM, Roy Braam <roybraam@anonymised.com> wrote:
Hi Frank,
Yep it’s a work around for if you want to use the BBOX param… Hmmmzzz,
actually I never used the BBOX param with geotools… It can only be used
with a http-get command… I don’t think it’s supported in the WFS
module… Maybe someone else knows something about it?Met vriendelijke groet,
Roy Braam
B3partners BV
030 214 2082
From: Frank Gasdorf [mailto:fgdrf@anonymised.com]
To: Roy Braam [mailto:roybraam@anonymised.com],
geotools-devel@lists.sourceforge.net
Sent: Mon, 25 Oct 2010 17:40:07 +0200
Subject: Re: [Geotools-devel] How to create BBOX Filter with FilterFactory2Thanks Roy!
This would a be possible solution -but from my point of view a workaround.
The reason of defining a “general” BBOX Filter is a single request and a
single response for that. I don’t want to have a lot of server roundtrip to
query each layer separate.
Is there an other way to use the gt-wfs module to create a query like that.
There is no reason to have a dataStore because the client is not enabled for
editig features. What I’d expect is a simple featureCollection that
repesents the resullt of the query with the given URL (see below).Any hints?
Frank
2010/10/25 Roy Braam <roybraam@anonymised.com>
Hello Frank,
When using the FilterFactory you are creating a filter and that’s not the
same as the param BBOX. See the ogc wfs specs 1.1.0 chapter 14.3.3.If you like to query with a bbox filter then you have to specify the
geometry attribute name.
So you can do something like this: (i added the code in you code snippet)for(String typeName; typeNames){
SimpleFeatureType type=dataStore.getSchema(typeName);
String geomName=type.getGeometryDescriptor().getLocalName();BBOX bbox = filterFactory.bbox(geomName, 13.35, 52.43, 13.45, 52.53,
“4326”); //$NON-NLS-1$
FeatureSource<SimpleFeatureType, SimpleFeature> view =
dataStore.getView(new DefaultQuery(null, bbox));
FeatureCollection<SimpleFeatureType, SimpleFeature> features =
view.getFeatures();Iterator iterator = features.iterator();
while (iterator != null && iterator.hasNext()) {
SimpleFeature next = iterator.next();
SimpleFeatureType type = next.getType();
System.out.println(type.getTypeName() + “\n\t” +
next.getDefaultGeometry());
}
}I didn’t tested it but it must be something like this.
Roy
From: Frank Gasdorf [mailto:fgdrf@anonymised.com]
To: geotools-devel@lists.sourceforge.net,
geoserver-devel@lists.sourceforge.net, geoserver-users@anonymised.comourceforge.net
Sent: Mon, 25 Oct 2010 13:34:59 +0200
Subject: [Geotools-devel] How to create BBOX Filter with FilterFactory2Hallo gt- and gs- developers,
Sorry for cross posting!
I’m using geoserver 2.x (means 2.0.x and 2.1-beta2) and try to connect
with geotools gt-wfs client to query features from different types with a
bbox filter. This should be an alternative way to the WMS getFeature
requests.I defined a query using the DEMO request on the geoserver home, the URL
request looks like this:Note: the value for typeName parameter is a comma separated list of
feature type names. The result I got for this request is what I expected :
features are returned from more than one feature type.Now I’d like to query using the filterFactory2.bbox method to define the
filter. How can I create a request like described before with the GT API?
The bbox method expects an expression or a string for geometry attribute
name. How can I gain it with GT API?Any suggestions?
Thanks a lot,
Frankcode snippet:
Map<String, String> connectionParameters = new HashMap<String,
String>();
connectionParameters.put(
“WFSDataStoreFactory:GET_CAPABILITIES_URL”, connectionURL);
//$NON-NLS-1$
DataStore dataStore =
DataStoreFinder.getDataStore(connectionParameters);String typeNames = dataStore.getTypeNames();
FilterFactory2 filterFactory = CommonFactoryFinder
.getFilterFactory2(GeoTools.getDefaultHints());
// berlin 13.40 52.48
String nullString = null;
BBOX bbox = filterFactory.bbox(nullString, 13.35, 52.43, 13.45,
52.53, “4326”); //$NON-NLS-1$
FeatureSource<SimpleFeatureType, SimpleFeature> view =
dataStore.getView(new DefaultQuery(null, bbox));
FeatureCollection<SimpleFeatureType, SimpleFeature> features =
view.getFeatures();Iterator iterator = features.iterator();
while (iterator != null && iterator.hasNext()) {
SimpleFeature next = iterator.next();
SimpleFeatureType type = next.getType();
System.out.println(type.getTypeName() + “\n\t” +
next.getDefaultGeometry());
}
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel