Suneesh, this error (rather obscurely) indicates that GeoTools is unable to locate the default Geometry for this feature type.
From where are you getting your features? Are you sure that they do have a default geometry (or any Geometry at all)? I suspect that you may have a problem in your features. They may not have a default geometry set. Kind regards, Ben. On 05/10/09 15:54, suneesh kumar wrote: > Hello, > > I am trying to extract geometry of feature by iterating FeatureCollection. > > My code is this : > feature.getDefaultGeometryProperty().getValue() > > But it is giving the following error : > > java.lang.ClassCastException: org.geotools.feature.DefaultFeature$1 cannot be > cast to com.vividsolutions.jts.geom.Geometry > at > org.geotools.feature.DefaultFeature.getDefaultGeometry(DefaultFeature.java:365) > at > org.geotools.feature.DefaultFeature.getDefaultGeometry(DefaultFeature.java:67) > at > org.geotools.feature.simple.SimpleFeatureImpl.getDefaultGeometryProperty(SimpleFeatureImpl.java:240) > > > How can I etract geometry from a feature collection? I am using the > Geotools2.6 > > Thanks in advance. > Sunish. > > > > ________________________________ > ________________________________ > Keep up with people you care about with Yahoo! India Mail. Learn > how<http://in.rd.yahoo.com/tagline_galaxy_1/*http://in.overview.mail.yahoo.com/connectmore>. > -- Ben Caradoc-Davies <[email protected]> Software Engineer, CSIRO Earth Science and Resource Engineering Australian Resources Research Centre 26 Dick Perry Ave, Kensington WA 6151, Australia ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
