Hi,

I'm trying to clip WFS features.

I'm working in GetFeature.java.

Everything seems to work fine but still the whole features are returned.

Here's my code :

org.geotools.geometry.jts.GeometryClipper clipper = new
org.geotools.geometry.jts.GeometryClipper((Envelope) bounds);
SimpleFeatureCollection SFC = (SimpleFeatureCollection)features;
try (FeatureIterator<SimpleFeature> iterator = SFC.features()){
     while( iterator.hasNext() ){
           SimpleFeature feature = iterator.next();
          
feature.setDefaultGeometry(clipper.clip((Geometry)feature.getDefaultGeometry(),
false));
     }
}
SimpleFeatureType targetType = (SimpleFeatureType)features.getSchema();
features = new FeatureBoundsFeatureCollection((SimpleFeatureCollection)
features, targetType);

...
results.add(features);

Thanks



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html


_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to