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