Hi Mihaja,

Unfortunately, I do not believe there is a CQL function to determine if 
a geometry is valid or not.  In some sense, this is ok as there is no 
way for a database or datastructure to optimize searching for the 
geometries which are broken.

That said, you should be able to use the JTS Geometry.isValid function 
to help.

Try something like...

SimpleFeatureCollection features = source.getFeatures(); // no need to 
filter; we will look at each geometry.
for (SimpleFeature feature : features) {
   Geometry geometry = (Geometry) feature.getDefaultGeometry();
   if (!geometry.isValid()) {
     //Do something with the valid geometries.  Add to feature 
collection for display?
   }
}

Hopefully that helps; let us know if you have any questions.

Cheers,

Jim

On 06/08/2016 04:50 AM, Mihaja raji wrote:
> Hi all, my function like this to detect error geometry in a shapefile
> but the query is not found
>
>   private void errorTopology() throws Exception {
>          String typeName = (String) featureTypeCBox.getSelectedItem();
>          SimpleFeatureSource source = dataStore.getFeatureSource(typeName);
>          //this function is not found
>          Filter filter = CQL.toFilter("not st_isvalid(the_geom)");
>          SimpleFeatureCollection features = source.getFeatures(filter);
>          FeatureCollectionTableModel model = new
> FeatureCollectionTableModel(features);
>          table.setModel(model);
>      }
> what is the true query to put at this filter
>
> Thanks
>
> ------------------------------------------------------------------------------
> What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
> patterns at an interface-level. Reveals which users, apps, and protocols are
> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> J-Flow, sFlow and other flows. Make informed decisions using capacity
> planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to