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.
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. Jody On Tue, Oct 26, 2010 at 5:14 PM, Roy Braam <[email protected]> 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:[email protected]] > To: Roy Braam [mailto:[email protected]], > [email protected] > Sent: Mon, 25 Oct 2010 17:40:07 +0200 > Subject: Re: [Geotools-devel] How to create BBOX Filter with FilterFactory2 > > Thanks 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 <[email protected]> >> >> 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<SimpleFeature> 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:[email protected]] >> To: [email protected], >> [email protected], [email protected] >> Sent: Mon, 25 Oct 2010 13:34:59 +0200 >> Subject: [Geotools-devel] How to create BBOX Filter with FilterFactory2 >> >> Hallo 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: >> >> >> http://localhost:8080/geoserver/wfs?request=GetFeature&version=1.1.0&typeName=naturalEarth:ne-10m-populated-places,naturalEarth:ne-10m-admin-0-countries&BBOX=-75.102613,40.212597,-72.361859,41.512517,EPSG:4326 >> >> 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, >> Frank >> >> code 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<SimpleFeature> 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 > [email protected] > https://lists.sourceforge.net/lists/listinfo/geotools-devel > > ------------------------------------------------------------------------------ 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 [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
