Hello Ben,
Thanks for your help.
When I printed the feature I got this result:
Feature[ id=fid-210abac6_12423ea2025_-8000 , the_geom=:the_geom=MULTIPOLYGON
(((923781.578765854 1021445.18786308, 923793.237430999 1021443.68264572,
923812.807279689 1021440.48084847, 923833.982821523 1021433.35355761,
923837.074482658 1021408.83317833, 923841.057925336 1021387.92080829,
923850.455079465 1021374.3725159, 923855.689341004 1021371.12791891,
923866.990216335 1021360.11423809, 923873.175970243 1021354.17299777,
923878.613217111 1021355.55663781, 923883.180570544 1021355.19577407,
923888.687962009 1021344.8147054, 923892.552220043 1021331.48443413,
923904.075641697 1021328.60576522, 923906.351669354 1021299.1541609,
923897.267681752 1021298.88531351, 923897.554207871 1021262.81799109,
923899.871765895 1021244.15937833, 923900.352417863 1021217.2042322,
923901.217576539 1021168.44719693, 923900.397923364 1021150.40450225,
923806.068185044 1021153.25573024, 923795.07605981 1021153.27552583,
923794.149411961 1021245.34178948, 923790.885418252
1021347.02973132, 923791.038644846 1021348.73135388, 923792.196211136
1021361.58643905, 923785.839753911 1021399.74348569, 923780.324004925
1021426.57385127, 923781.578765854 1021445.18786308))) , NAME=:NAME=111/9 ]
But when I am trying feature.getDefaultGeometryProperty().getValue()
I get the ClassCastException.
Do you think there is any problem with the geometry?
Thanks,
Sunish./
--- On Mon, 5/10/09, Ben Caradoc-Davies <[email protected]> wrote:
From: Ben Caradoc-Davies <[email protected]>
Subject: Re: [Geotools-gt2-users] Problem with Feature
To: "suneesh kumar" <[email protected]>
Cc: "[email protected]"
<[email protected]>
Date: Monday, 5 October, 2009, 2:12 PM
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
From cricket scores to your friends. Try the Yahoo! India Homepage!
http://in.yahoo.com/trynew------------------------------------------------------------------------------
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